Community
Participate
Working Groups
Build ID: I20080617-2000 Steps To Reproduce: 1. Go to Preferences -> Java -> Code Style -> Formatter -> Edit on the "Eclipse [built-in]" profile 2. Go to Tab "Line Wrapping", Select "Function Calls" 3. On the Preview Tab Set Line Width for 25 or smaller The original line: Other.bar(100, 200,....) will be formatted Other. bar( 100, 200, Obviously wrapping is necessary because the original line is longer than the set line width, but wrapping after Other. and bar( doesn't do any good because the identifiers Other and bar are shorter than the indentation depth (2 tabs == 8 spaces). Suggested fix: Add an additional Line Wrapping Policy "Wrap when benefitial" which works like "Wrap when necessary" but avoids wrapping if the leading line is shorter than the indentation width and thus wrapping is counter-productive. Result: Other.bar( 100, 200,... Thanks for taking note! Christopher P.S.: Note that with "Wrapping when benefitial" the resulting format is less Wide than with "Wrapping if necessary".
This goes in the lines of what I would like to see improved in the line wrapping for 3.6.
Created attachment 155131 [details] Proposed patch This patch fixes the problem in the peculiar case of comment 0 and does not need any new preference. I preferred to fix it this way as I think the formatter already has enough preferences and adding a new one should be motivated by a real need. I've run all JDT Core, UI and Text tests using this patch and I only observed one failure in the UI test which is a logical consequence of the fix. I'll add a specific patch to fix the UI test... Note that I also ran formatter massive tests, but there are too many changes to verify them all (a little bit more than 5,000 CUs had a different output with this patch...!). However, for all CUs I have verified (around half of them!), the difference were also logical consequence of the fix and definitely improved the formatter output :-)
Created attachment 155132 [details] Proposed patch to fix the failure in JDT-UI test
(In reply to comment #3) > Created an attachment (id=155132) [details] [diff] > Proposed patch to fix the failure in JDT-UI test Looks good, thanks. Please ping me when you release the Core part, so I can follow for the same N-build.
(In reply to comment #2) > Created an attachment (id=155131) [details] > Proposed patch > Released for 3.6M5 in HEAD stream.
Verified for 3.6M5 using Build id: I20100122-0800
Verified.
Thanks guys for fixing this issue! Looking forward for 3.6M5 Take care and greetings from Berlin, Christopher
*** Bug 214743 has been marked as a duplicate of this bug. ***
*** Bug 130471 has been marked as a duplicate of this bug. ***
*** Bug 83915 has been marked as a duplicate of this bug. ***
*** Bug 143634 has been marked as a duplicate of this bug. ***
*** Bug 99026 has been marked as a duplicate of this bug. ***
*** Bug 189983 has been marked as a duplicate of this bug. ***
*** Bug 104004 has been marked as a duplicate of this bug. ***
*** Bug 104774 has been marked as a duplicate of this bug. ***
*** Bug 114639 has been marked as a duplicate of this bug. ***
*** Bug 117896 has been marked as a duplicate of this bug. ***
*** Bug 147623 has been marked as a duplicate of this bug. ***
*** Bug 196563 has been marked as a duplicate of this bug. ***
*** Bug 197155 has been marked as a duplicate of this bug. ***