Bug 304705

Summary: [formatter] Unexpected indentation of wrapped line comments when 'Never indent line comment on first column' preference is checked
Product: [Eclipse Project] JDT Reporter: Frederic Fusier <frederic_fusier>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann
Version: 3.6   
Target Milestone: 3.6 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed patch none

Description Frederic Fusier CLA 2010-03-04 12:13:52 EST
While testing UI for bug 251133, I saw a weird behavior of the formatter when the 'Never indent line comment on first column' is activated.

The example is:
interface Example {
// This is a long comment    with	whitespace     that should be split...
	int foo3();
...
}

When checking the 'Never indent line comment on first column' preference, I got this output:

interface Example {
// This is a long comment with whitespace that should be split in multiple line
	// comments in case the line comment formatting is enabled
	int foo3();
...
}

Which first looks really weird. As the comment is on first column, I would expect the formatter to set the wrapped line comments also on the first column, hence I should get the following output:

interface Example {

// This is a long comment with whitespace that should be split in multiple line
// comments in case the line comment formatting is enabled
	int foo3();
...
}
Comment 1 Frederic Fusier CLA 2010-03-04 12:15:33 EST
Note that this is not a regression introduced by the fix for bug 251133 as I get the same behavior in 3.6M5...
Comment 2 Frederic Fusier CLA 2010-03-04 12:21:02 EST
In fact this is a regression introduced while re-writing the formatter for comments... It worked properly in 3.3.2 but was broken in 3.4.0..
Comment 3 Frederic Fusier CLA 2010-03-04 12:35:49 EST
Created attachment 160980 [details]
Proposed patch

Fix is trivial, just do not indent while wrapping the comment line if the preference is set...
Comment 4 Frederic Fusier CLA 2010-03-05 02:55:26 EST
(In reply to comment #3)
> Created an attachment (id=160980) [details]
> Proposed patch
> 
Released for 3.6M6 in HEAD stream.
Comment 5 Olivier Thomann CLA 2010-03-08 13:36:38 EST
Verified for 3.6M6 using I20100307-2000.