Summary: | [formatter] 'Never Join Lines' joins lines that are split on method invocation | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Travis Mising name <shepherd.travis> |
Component: | Core | Assignee: | Frederic Fusier <frederic_fusier> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | amj87.iitr, Olivier_Thomann, satyam.kandula, shepherd.travis |
Version: | 3.5 | ||
Target Milestone: | 3.6 M2 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Travis Mising name
2009-08-14 14:46:20 EDT
I have some problems with your scenario. Using Eclipse built-in profile, I cannot reproduce step 5 (i.e. on a single line), I always get 3 lines: >> >> builder.append("abc").append("def").append("ghi").append("jkl").append( >> >> >> >> "mno") >> >> >> >> .append("pqr").append("stu").append("vwx").append("yz"); (where '>> ' shows a tabulation) Do you modify the default Eclipse built-in profile? I also see on step 9 that the second line is indented: >> >> builder.append("abc").append("def").append("ghi").append("jkl").append( >> >> >> >> "mno").append("pqr").append("stu").append("vwx").append("yz"); although it should not: >> >> builder.append("abc").append("def").append("ghi").append("jkl").append( >> >> "mno").append("pqr").append("stu").append("vwx").append("yz"); So, I definitely agrees that there's a real issue... I just need a clear test case to highlight it. Here's my proposal using '>> ' as a tabulation: public class Test { >> void foo() { >> >> StringBuilder builder = new StringBuilder(); >> >> builder.append("abc").append("def") >> >> .append("ghi").append("jkl").append("mno") >> >> .append("pqr").append("stu").append("vwx").append("yz"); >> } } Currently, using Eclipse built-in profile + 'Never join lines'=true + 'Maximum Line width'=40, the test case above is formatted as follow: public class Test { >> void foo() { >> >> StringBuilder builder = new StringBuilder(); >> >> builder.append("abc").append( >> >> >> >> "def") >> >> >> >> .append("ghi").append( >> >> >> >> "jkl").append("mno") >> >> >> >> .append("pqr").append( >> >> >> >> "stu").append("vwx") >> >> >> >> .append("yz"); >> } } Instead we should have: public class Test { >> void foo() { >> >> StringBuilder builder = new StringBuilder(); >> >> builder.append("abc").append( >> >> >> >> "def") >> >> .append("ghi").append("jkl") >> >> >> >> .append("mno") >> >> .append("pqr").append("stu") >> >> >> >> .append("vwx").append( >> >> >> >> >> >> "yz"); >> } } Another variation which may be more convincing... Here's the test case: public class Test { >> void foo() { >> >> StringBuilder builder = new StringBuilder(); >> >> builder.append("abc").append("def") >> >> .append("ghi").append("jkl").append("mno") >> >> .append("pqr").append("stu").append("vwx") >> >> .append("yz"); >> } } Currently, using Eclipse built-in profile + 'Never join lines'=true + 'Maximum Line width'=60, the test case above is formatted as follow: public class Test { >> void foo() { >> >> StringBuilder builder = new StringBuilder(); >> >> builder.append("abc").append("def") >> >> >> >> .append("ghi").append("jkl").append("mno") >> >> >> >> .append("pqr").append("stu").append("vwx") >> >> >> >> .append("yz"); >> } } although it should be unchanged... I forgot to mention that I have the line length set to something exorbitantly high, like 200 characters. That is probably why you are seeing three lines instead of the two. (In reply to comment #3) > I forgot to mention that I have the line length set to something exorbitantly > high, like 200 characters. That is probably why you are seeing three lines > instead of the two. > This was my assumption, thanks to confirm it. This bug will be fixed by the patch of bug 286912: https://bugs.eclipse.org/bugs/attachment.cgi?id=144846 Released for 3.6M2 in HEAD stream. Verified for 3.6M2 using I20090914-1800 Verified. |