Community
Participate
Working Groups
Build Identifier: 20100917-0705 preferences -> Java -> Code Style -> Formatter After creating new profile based on Eclipse [built-in], edit the profile. On Indentation tab, in Indent section, select (add check to) "Empty lines". On Blank Lines tab, if you add more than one line for example setting "Before method declarations" to 3, then only the first line is indented but the subsequent lines (e.g., two in this case) are not indented. I believe that all of the respective lines should be indented. Additionally, after setting on the Blank Lines tab, "Number of empty lines to preserve" to 99, then when formatting a java document, rather than leaving the blank lines between methods as "preserved" which I take as unchanged, it removes the tab indents that I had manually added on sequential blank lines beginning with the second one. Also, I noticed there may be some outcome reliability issue(s) related to when making the settings on the Blank Lines tab of the formatter edit dialog. At one point, when I opened the formatter edit dialog, Blank Lines tab, it displayed the first 2 lines indented and subsequent ones (e.g., the following three) as not indented; then after changing "Before declarations of the same kind" from 1 to 3 and then back to 1, only the first line was indented but not subsequent ones. Reproducible: Always Steps to Reproduce: 1.See details section, first paragraph.
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