Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Comment alignment(New feature request: Comments aligned over on the right side at a fixed column position.)
icon3.gif  Comment alignment [message #534453] Wed, 19 May 2010 05:20 Go to next message
Eclipse UserFriend
I am coming from other languages to the Eclipse Java IDE (which in general is excellent Smile ) and the thing I immediately dislike is that comments and code are all mixed up together.

I usually comment most lines that are not trivial and include block comments at appropriate points to lead the reader thru what I am doing.
I propose that the IDE should have one keystroke to start a line comment or re-align an existing comment at a given fixed column position.
In this way you can clearly read thru the code most of the time without the comments getting in the way and can look across at the comments when something is unclear.

If I wanted to implement this myself would writing a new plugin be the only way to go?

Thanks

[Updated on: Wed, 19 May 2010 05:23] by Moderator

Re: Comment alignment [message #534464 is a reply to message #534453] Wed, 19 May 2010 05:44 Go to previous messageGo to next message
Eclipse UserFriend
I believe you are asking for the folding feature. Notice a small icon with - near the comment. On selection of the icon, the comment should be folded.
The comments can be folded when the file is opened -- Go to Window->Preferences->Java->Editor->Folding and select Comments.
Re: Comment alignment [message #534470 is a reply to message #534464] Wed, 19 May 2010 06:00 Go to previous messageGo to next message
Eclipse UserFriend
Hi Satyam,

Thanks but that is not quite what I am after as most of the comments that I want moved are single line comments.
I think it would be much clearer and tidier if a fixed column position could be nominated for the single line comments that the IDE managed for the user.
Re: Comment alignment [message #534483 is a reply to message #534470] Wed, 19 May 2010 06:30 Go to previous messageGo to next message
Eclipse UserFriend
Hi Dan,

Not sure I understand what feature you are looking for. The IDE doesn't
manage any comments for you at all.

When creating files or methods etc.it may include comments in the code.
You can change this behaviour by switching off the appropriate options
or modifying the templates used (all through Windows/Preferences).

When you use the formatting feature of JDT (Ctrl-Shift-F), comments
should be wrapped at the print margin, but they will completely begin at
the column that you started them at.

So, if you want all comments to start at a particular column position,
all you have to do is make sure you enter them at that position. Eclipse
shouldn't touch this at all.

Cheers,

Steffen

On 19/05/2010 11:00, Dan Earle wrote:
> Hi Satyam,
>
> Thanks but that is not quite what I am after as most of the comments
> that I want moved are single line comments.
> I think it would be much clearer and tidier if a fixed column position
> could be nominated for the single line comments that the IDE managed
> for the user.
>
Re: Comment alignment [message #534532 is a reply to message #534483] Wed, 19 May 2010 08:52 Go to previous message
Eclipse UserFriend
Hi Steffen,

Thanks. So all I need is an automated way of adding the comment at the required column position, how should I do that?

On my old IDE I had a macro.

EDIT: although it does seem that the (Ctrl-Shift-F) is moving my comments in towards the code, it puts one space between the end of the statement and the //

[Updated on: Wed, 19 May 2010 08:56] by Moderator

Previous Topic:How to get the user library and its jars defined in PreferencePage with code?
Next Topic:Always getting error "java.lang.ArrayIndexOutOfBoundsException: 2048"
Goto Forum:
  


Current Time: Mon Mar 17 21:57:33 EDT 2025

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

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

Back to the top