Bug 76543 - inline "//" comments that are wrapped to the next line.
Summary: inline "//" comments that are wrapped to the next line.
Status: RESOLVED DUPLICATE of bug 47620
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.0.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-19 02:46 EDT by Justin Corpron CLA
Modified: 2004-10-19 13:07 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Corpron CLA 2004-10-19 02:46:21 EDT
This "bug" is a result of two opposing behaviors with "//" comments. When a
single line comment is added to the end of a line containing some code like:

   int myVariable = SOME_LONG_CONSTANT; // this is for something or other.

if this line is longer than the column constrain (80 chars) then when the
formatter is run the comment is properly wrapped and aligned to the next line
like so:

   int myVariable = SOME_LONG_CONSTANT; // this is for 
                                        // something or 
                                        // other.

But, if the formatter is run again, the wrapped lines of the comment are pulled
back to default indentation and a new line is added:

   int myVariable = SOME_LONG_CONSTANT; // this is for 

   // something or 
   // other.

The comment is now segmented and its message is somewhat lost. I suggest that
when the formatter needs to wrap a inline comment that the "//" commenting be
replaced with a 
/*
 * 
 */
and that as a general behavior with the non-javadoc, multi-line comment that the
formatter always align the '*' characters based on the position of the first '*'
and that either the opening "/*" is placed one space behind an expression it
shares a line with or if there is no expression then the "/*" should be set at
default indentation.

Example:

   int myVariable = SOME_LONG_CONSTANT; // this is for something or other.

Would result in:

   int myVariable = SOME_LONG_CONSTANT; /* 
                                         * this is for 
                                         * something or 
                                         * other.
                                         */

But the "/*" would only be placed as follows normally:
   /*
    * Some comment.
    */

Thanks,

- Justin
Comment 1 Olivier Thomann CLA 2004-10-19 10:39:22 EDT
Move to JDT/Text
Comment 2 Dani Megert CLA 2004-10-19 13:07:35 EDT
This bug contains another suggestion in how to solve bug 47620.

*** This bug has been marked as a duplicate of 47620 ***