Bug 305371

Summary: [formatter] Unexpected indentation of line comment
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: jarthana, markus.kell.r, satyam.kandula
Version: 3.6   
Target Milestone: 3.6 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed patch none

Description Frederic Fusier CLA 2010-03-10 13:22:11 EST
Using I20100309-0809.

The following snippet:
class Example {
//  unformatted    comment    !
		//  formatted    comment    !
}

When deselecting the preference "Format line comments on first column", I get the following unexpected output:
class Example {
//  unformatted    comment    !
// formatted comment !
}

Instead, I would expect:
class Example {
//  unformatted    comment    !
	// formatted comment !
}
Comment 1 Frederic Fusier CLA 2010-03-10 13:25:24 EST
The following snippet with the same option:
class Example {
//  unformatted    comment    !

		//  formatted    comment    !
}

is well formatted:
class Example {
//  unformatted    comment    !

	// formatted comment !
}

Note the empty line between the comments...
Comment 2 Frederic Fusier CLA 2010-03-16 06:10:39 EDT
Created attachment 162152 [details]
Proposed patch

With this patch the formatter now considers that two consecutive comments are not contiguous when one of them is on first column and the preference to format this kind of comment is deactivated.
Comment 3 Frederic Fusier CLA 2010-03-16 06:11:13 EDT
Released for 3.6M7 in HEAD stream.
Comment 4 Satyam Kandula CLA 2010-04-26 05:56:05 EDT
Verified for 3.6M7 using build I20100424-2000