| Summary: | [formatter]Java Code Style Formatter tags not working in when included in block comments | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Jay Catelli <jc> |
| Component: | Core | Assignee: | Mateusz Matela <mateusz.matela> |
| Status: | RESOLVED DUPLICATE | QA Contact: | |
| Severity: | trivial | ||
| Priority: | P3 | CC: | erick.hagstrom, manoj.palat, mateusz.matela |
| Version: | 4.3.2 | ||
| Target Milestone: | 4.18 M3 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | To be verified for 4.18 M3 | ||
|
Description
Jay Catelli
I looked at the code in passing while fixing bug 431532 and this is what I think is happening: the Off/On tags apply to the full comment they are found in, so in your case the whole comment first has the formatter turned off and then almost straight away the whole comment has the formatter turned back on again. So that's a no-op! Changing the formatter code to work with regions within a single comment is probably not trivial, but I'm sure a patch would always be welcome. As a workaround, you could try switching from the block comment to using single-line comments instead. (In reply to Timo Kinnunen from comment #1) > I looked at the code in passing while fixing bug 431532 and this is what I > think is happening: the Off/On tags apply to the full comment they are found > in, so in your case the whole comment first has the formatter turned off and > then almost straight away the whole comment has the formatter turned back on > again. So that's a no-op! Changing the formatter code to work with regions > within a single comment is probably not trivial, but I'm sure a patch would > always be welcome. > > As a workaround, you could try switching from the block comment to using > single-line comments instead. It workaround provided does work. (In reply to Timo Kinnunen from comment #1) > I looked at the code in passing while fixing bug 431532 and this is what I > think is happening: the Off/On tags apply to the full comment they are found > in, so in your case the whole comment first has the formatter turned off and > then almost straight away the whole comment has the formatter turned back on > again. So that's a no-op! The "Off/On Tags" preferences screen advertises a different reality. There it says, "- Each time the formatter sees an off tag, it disables formatting for that comment and the source after it." and "- Each time the formatter sees an on tag, it enables formatting for the source after that comment." So the Off tag is properly turning off formatting for the comment, but the On tag is not supposed to turn on formatting until after the comment. My preference, FWIW, is for the code to do what the preferences screen says it does. That seems like reasonable behavior and doesn't run into the complexities you mention for regions (or so I would imagine). Sorry, can't submit a patch yet. Working on getting a CLA, but it's slow going. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. Just checked in 4.5 and 4.18. This bug no longer occurs after the formatter redesign. *** This bug has been marked as a duplicate of bug 303519 *** |