Summary: | comments formatted even if "Enable comment formatting" is disabled | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Jon Nall <nall> |
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | dberindei, deven, john.ferg |
Version: | 3.0 | ||
Target Milestone: | 3.3 M7 | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: |
Description
Jon Nall
2003-12-23 12:31:54 EST
I assume you are using M6? oh, sorry i didn't add that info. Version: 3.0 Build id: 200312182000 which is 3.0-M6 Can be reproduced using I20040106 I believe this is the core formatter that modifies the indent for multiline-comments (correct me if not). Of course, core cannot access the "format comments" jdt-ui preference, but perhaps you could either expose a preference for formatting comments and leave them alone if not? Or even introduce a preference to use c-style formatting: /** * c-style */ yes, i've confirmed that it's in the core formatter. This is particularly bad when you choose to use C-style comments to comment out a block of code -- the new code formatter discards all the original indentation from the code and flush-aligns each line to a fixed indentation level. Because of this bug, I need to go back to using the old code formatter. How about only aligning the indentation of C-style comments if each line starts with a * character? That's probably the only time it's the right thing to do. Does the C-style comment requires the first line to start with /**? In Java, this indicates a javadoc comment (vs a block comment). I can add an option to align starting stars in javadoc comments only. And leave the block comments untouched. In this case, I'm talking about a block comment, not a Javadoc comment. However, I think it's perfectly reasonable (and desirable) for Javadoc AND block comments to have a leading * aligned with the opening /* of the comment, if EVERY line of the comment begins with a *. (If only some do, it might be a bullet list.) The comment I mentioned was a block comment containing code which had been commented out. All the indentation in this code was removed, making the code very difficult to read. Actually, looking again at the old formatter's behavior, it does reindent block comments, but it maintains all relative indentation within the comment. This is reasonable behavior, and handles lines of *'s and commented-out code equally well. Why is this not the behavior of the new formatter? Will reconsider post 3.0. Reopen If you expect your comment to be untouched when comment formatting is disabled, do you expect them to be indented? Released for 3.3M7. Code released as part of bug 20793. Regression test added in org.eclipse.jdt.core.tests.formatter.FormatterRegressionTests.test665() *** Bug 172324 has been marked as a duplicate of this bug. *** Verified for 3.3 M7 using build I20070427-0010. |