Community
Participate
Working Groups
using I20050627-1435 If I copy a single line comment from one line to another, the comment is not properly aligned to the code. Example: public void foo() { // some comment which I try to copy to the line after the int int x; } results in: public void foo() { // some comment which I try to copy to the line after the int int x; // some comment which I try to copy to the line after the int }
We use the formatter for this. Can you try to: 1. format your code 2. retry your example?
Could you be a little bit more specific about how to specify this in the Formatter? I can't find any suitable option for this issue.
Not sure what concrete setting makes the difference. For example tabs/spaces setting could be the problem: the code you pasted in comment 0 uses spaces for indentation while the default formatter setting is to use (4) tabs only.
I did not copy the code directly from Eclipse but just typed in some example to indicate what the problems are. I just used 4 spaces to align the code somehow (and surely: Eclipse would use some other identation). The Example was just meant to give a an idea of what the problem is. Maybe you should try to copy one comment line in your texteditor and paste it into another line to see what happens.
That's what I did, so maybe you provide your real steps so that we can reproduce ;-) See also: http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-text-home/development/bug-incomplete.htm
Steps to reproduce: 1. Write a function like this: public void foo() { // some comment int x; } 2. Select the comment with your mouse starting from the first slash character up to the last charachter of the comment 3. Copy the selected comment using Ctrl+c 4. Put your cursor right after the semicolon of the x definition and press enter to get a new line 5. Use Ctrl+v to insert the copied comment to this line 6. You should now have something that looks like this: public void foo() { // some comment int x; // some comment } What I claim is that I would like the comment to be at the same position like the first original comment (this is having the same indentation). I can reproduce this as many times as I want and I also tried it out on another machine (running the same Eclipse version). Please note that the above code was directly copied from Eclipse and that the default Eclipse formatter settings are used. If you do not get the same result is I do, it might be the case that you already fixed this bug in your latest integration build... Can you comment on that?
Created attachment 34874 [details] Screenshot of comment in editor To make my point even clearer, I made a screenshot of the editor before and after copying the comment. But see for yourself.
Dani, could you please have a look at this again? Thank you!
>2. Select the comment with your mouse starting from the first slash character up Here we go! Up to know you always spoke about "line" and not that you started the selection at '/'. Could have saved us some time ;-) *** This bug has been marked as a duplicate of 65841 ***