Summary: | [formatter] Java formatter, Blank Lines tab, only 1st line indented when multiple lines is set | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Jeffrey Wexler <bsgcic1776> |
Component: | Core | Assignee: | Frederic Fusier <frederic_fusier> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | minor | ||
Priority: | P3 | CC: | amj87.iitr, daniel_megert, Olivier_Thomann, satyam.kandula |
Version: | 3.7 | ||
Target Milestone: | 3.7 M5 | ||
Hardware: | PC | ||
OS: | Linux | ||
Whiteboard: | |||
Attachments: |
Description
Jeffrey Wexler
2010-12-17 01:32:27 EST
Moving to JDT It looks like this contains several issues. Please one issue per bug only. Also, please attach your formatter profile and a test snippet. Created attachment 185512 [details]
Custom formatter profile
Created attachment 185513 [details]
Test snippet - I think this is what you wanted, right?
In terms of the number of issues, I am guessing that the additional info that I mentioned in the 3rd paragraph of the description section is related to this bug. If not, then I'll go ahead and separate that 3rd paragraph (beginning with "Also, I noticed") as a separate bug report. (In reply to comment #4) > Created an attachment (id=185513) [details] [diff] > Test snippet - I think this is what you wanted, right? We mean a code snippet or java file which could show the problem on formatting using your formatter settings. (In reply to comment #5) > In terms of the number of issues, I am guessing that the additional info that I > mentioned in the 3rd paragraph of the description section is related to this > bug. If not, then I'll go ahead and separate that 3rd paragraph (beginning with > "Also, I noticed") as a separate bug report. I tried but couldn't reproduce this. I always notice that irrespective of the number specified in "Before declarations of the same kind", only the first blank line is indented, and none after that. Created attachment 185613 [details]
Prior to Source-Format Element: Indented blank lines in lines 33 to 37
Created attachment 185614 [details]
After Source-Format Element on lines 32 to 39. Note blank lines 34 to 37 and 39 lost their indentation
Frederic, whats the correct behaviour in this case? (In reply to comment #9) > Frederic, whats the correct behaviour in this case? Until 3.6 (including 3.6.1) the formatter never leaves any tabs indentation on preserved empty lines. An enhancement request was opened about this (see bug 86249) but was deferred and falled as wontfix when resolved/later bugzilla state was removed. If this behavior should be changed, then this enhancement needs to be reopened... However, since 3.7 M1, the formatter now leaves the tabs indentation of the first empty lines. I think this is an unexpected behavior which should be fixed. We'll use this bug to track work around this last issue... (In reply to comment #10) > (In reply to comment #9) > > Frederic, whats the correct behaviour in this case? > > Until 3.6 (including 3.6.1) the formatter never leaves any tabs indentation on > preserved empty lines. An enhancement request was opened about this (see bug > 86249) but was deferred and falled as wontfix when resolved/later bugzilla > state was removed. > > If this behavior should be changed, then this enhancement needs to be > reopened... > > However, since 3.7 M1, the formatter now leaves the tabs indentation of the > first empty lines. I think this is an unexpected behavior which should be > fixed. We'll use this bug to track work around this last issue... Ooops, I made a mistake while doing my tests with previous Eclipse versions. I forgot to check the 'Empty Lines' check-box in Indentation formatter preferences tab... Doing it, then it appears that this weird behavior seems to exist since day 1 (at least since 3.3, I didn't test with previous versions). Hmm, this slightly change the conclusion about this bug... :-S First, it seems that bug 86249 was finally implemented as there's the Indent Empty Lines preference in the Indentation tab... However, the bug is still as WONTFIX!? Second, it seems that this option does not work well as described in this bug. I agree that it should always keep the existing indentation of the empty lines and add it if it does not exist (as per bug 86249 comment 0) Third, as the formatter is the same since 3.3, it's not a regression as I initially thought... The conclusion is that we definitely have a a bug. The different issues described in comment 0 are all the same from my point of view. As soon as the formatter will set all the empty lines indentation correctly, they should be all fixed... Created attachment 185757 [details]
Proposed patch
There was a small glitch while adding empty lines when the indentation preferences was set. The column needed to be reset to 1 to have correct indentation printed in the buffer...
Released for 3.7M5 in HEAD stream. Verified for 3.7M5 using build I20110124-1800 |