Community
Participate
Working Groups
As of 4.5.0, the "Tab size" parameter in the Java formatter options affects the indentation level, rather than just the number of characters between tab stops, when Tab policy is "Tabs only" The attached files are copy/pasted from the "Indentation" tab for the formatter options, with all "Indent" checkboxes ticked. Up to size 4 it appears as if the tab size is being used as a maximum indentation level. Size 5 adds an additional tab character to the start of all lines. Size 6 and up seem to progress as expected, i.e.: the tab stops get farther apart, but no new tabs characters are added. My expectation would be that the tab size parameter does not affect the number of tab characters that are used to indent, but instead controls how much horizontal space each tab character take up.
Created attachment 254708 [details] Formatter example at tab size = 2
Created attachment 254709 [details] Formatter example at tab size = 1
Created attachment 254710 [details] Formatter example at tab size = 3
Created attachment 254711 [details] Formatter example at tab size = 4
Created attachment 254712 [details] Formatter example at tab size = 5
Created attachment 254713 [details] Formatter example at tab size = 6
Ha! Just noticed that size 6 does in fact add another tab character to lines inside the switch case.
*** Bug 471014 has been marked as a duplicate of this bug. ***
Mateusz: Can you please take a look?
Looks like a duplicate of bug 467229. Ryan, does the workaround mentioned there work for you?
Created attachment 254780 [details] Wrong indentation in interface Setting tab size and indentation size to the same value while in 'spaces only' mode and then switching back seems to fix the issues pointed out by Ryan. However, the formatter does not work for me in interfaces, indenting every method except the first one level to much. Comments are indented correctly, though. This file has been formatted using 'tabs only' policy and indentation size and tab size set to 4 while the 'spaces only' policy was activated. The same problem appeared while setting both values to 2 as well.
(In reply to Tobias Stensbeck from comment #11) > This file has been formatted using 'tabs only' policy and indentation size > and tab size set to 4 while the 'spaces only' policy was activated. The same > problem appeared while setting both values to 2 as well. Interesting, but I cannot reproduce this effect. This seems to be unrelated to this bug though (because not all the lines are affected the same way), so please start a new bug and provide full steps to reproduce (or attach your formatter configuration, if this is enough).
(In reply to Mateusz Matela from comment #10) > Looks like a duplicate of bug 467229. > Ryan, does the workaround mentioned there work for you? Yep, that workaround fixes the issue for me. Cheers!
(In reply to Mateusz Matela from comment #12) > Interesting, but I cannot reproduce this effect. This seems to be unrelated > to this bug though (because not all the lines are affected the same way), so > please start a new bug and provide full steps to reproduce (or attach your > formatter configuration, if this is enough). Indeed it seems to be a different bug. I think it has something to do with the line wrapping policy. I started a new bug here: Bug 471364
*** This bug has been marked as a duplicate of bug 467229 ***
Verified for 4.5.1 using M20150819-1000 build