Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Pasting comments aligns with text, not slashes
Pasting comments aligns with text, not slashes [message #878509] Tue, 29 May 2012 13:07 Go to next message
Conan Cook is currently offline Conan CookFriend
Messages: 1
Registered: May 2012
Junior Member
Hi,

I've got a problem which has been around for some time in Eclipse 3.7.1, Indigo Service Release 1, Build id: 20110916-0149. I'm on Windows 7. When I paste a comment in a Java source file, the Eclipse formatter aligns it incorrectly at the start of the text in the comment, rather than the comment slashes themselves. For example, if I copy this:

// This is a comment
System.out.println("I have a comment");


And paste it to an indented location, It is incorrectly indented like this:

public void aMethod() {
 // This is a comment
    System.out.println("I have a comment");
}


As you can see, the indentation is correct in respect to the text of the comment, but the slashes are in the wrong place. This only occurs if I select the original text from the start of the text, not the start of the line (i.e. I miss out any leading tabs - although it also happens if there are no leading tabs on any of the source lines).

I've googled around the internets and this forum, and can't find anything discussing this issue, mainly because there appears to have been another issue with pasting comments related to auto-commented code. I am using a custom code formatter in Eclipse, but have confirmed that this happens with the built-in Eclipse formatter also.

Does anyone know what setting controls this, or how I can encourage Eclipse to paste so the result looks like this?

public void aMethod() {
    // This is a comment
    System.out.println("I have a comment");
}


Thanks very much,


Conan

[Updated on: Wed, 30 May 2012 08:57]

Report message to a moderator

Re: Pasting comments aligns with text, not slashes [message #882852 is a reply to message #878509] Thu, 07 June 2012 10:19 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 29.05.2012 15:07, Conan Cook wrote:
> Hi,
> I've got a problem which has been around for some time in Eclipse
> 3.7.1, Indigo Service Release 1, Build id: 20110916-0149. I'm on
> Windows 7. When I paste a comment in a Java source file, the Eclipse
> formatter aligns it incorrectly at the start of the text in the
> comment, rather than the comment slashes themselves. For example, if
> I copy this:
>
>
> // This is a comment
> System.out.println("I have a comment");
>
>
> And paste it to an indented location, It is incorrectly indented like
> this:
>
>
> public void aMethod() {
> // This is a comment
> System.out.println("I have a comment");
> }
>
>
> As you can see, the indentation is correct in respect to the text of
> the comment, but the slashes are in the wrong place. I've googled
> around the internets and this forum, and can't find anything
> discussing this issue, mainly because there appears to have been
> another issue with pasting comments related to auto-commented code. I
> am using a custom code formatter in Eclipse, but have confirmed that
> this happens with the built-in Eclipse formatter also.
>
> Does anyone know what setting controls this, or how I can encourage
> Eclipse to paste so the result looks like this?
Make sure Java > Editor > Typing: [ ] Adjust Indentation is selected. It
could also be something in your formatter profile. When I try it in a
new workspace using 3.8 RC3 it works as expected.

Dani
>
>
> public void aMethod() {
> // This is a comment
> System.out.println("I have a comment");
> }
>
>
> Thanks very much,
>
>
> Conan
Previous Topic:internal classes v.s. API
Next Topic:Launch config enablement
Goto Forum:
  


Current Time: Sat Apr 20 02:14:23 GMT 2024

Powered by FUDForum. Page generated in 0.03801 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top