Bug 302552 - [formatter] Formatting qualified invocations can be broken when the Line Wrapping policy forces element to be on a new line
Summary: [formatter] Formatting qualified invocations can be broken when the Line Wrap...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.6 M6   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-11 03:24 EST by Dani Megert CLA
Modified: 2010-03-09 11:39 EST (History)
1 user (show)

See Also:


Attachments
Proposed patch (5.74 KB, patch)
2010-02-11 09:10 EST, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2010-02-11 03:24:45 EST
I20100209-2300.

Java > Code Style > Formatter settings > Line Wrapping Tab: Function Calls > Qualified invocations: this seems only to work when I set the indentation policy to 'Indent by one'.
Comment 1 Frederic Fusier CLA 2010-02-11 04:28:58 EST
Do you have a snippet with which you got this problem?
Comment 2 Frederic Fusier CLA 2010-02-11 04:51:55 EST
This a side effect of the fix for bug 264112...

The formatter now does not wrap when the indentation is over the wrapped element position. But this should not be done when the element wrapping policy forces to wrap.

Typically with the formatter preference page:
/**
 * Qualified invocations
 */
class Example {
    int foo(Some a) {
        return a.getFirst();
    }
}

Selecting a line width for preview = 20, it's OK that the line is not wrapped with default Line wrapping policy 'Wrap when only necessary' but it should be wrapped with 'Wrap all elements, every element on a new line', 'Always wrap first element, others only when necessary', etc.

Hence, update summary...
Comment 3 Frederic Fusier CLA 2010-02-11 09:10:08 EST
Created attachment 158850 [details]
Proposed patch

Look at the Function Calls -> Qualified invocations Line Wrapping policy before activating the "smart" wrapping...
Comment 4 Frederic Fusier CLA 2010-02-12 04:51:27 EST
Released for 3.6M6 in HEAD stream.
Comment 5 Olivier Thomann CLA 2010-03-09 11:39:07 EST
Verified.