Bug 87193 - CodeFormatter Indent on column wrapping
Summary: CodeFormatter Indent on column wrapping
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 normal with 1 vote (vote)
Target Milestone: 3.2 M2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-04 17:03 EST by Dimitry Fayerman CLA
Modified: 2005-09-20 14:15 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Fayerman CLA 2005-03-04 17:03:13 EST
When "indent on column" option is selected for the method arguments
if the arguments do not fit the defined line length, the whole column should
wrap.
Example with current formatter:
MyLongClassName myLongVariable = someOtherLongCode(param1,
                                                   param2,
                                                   param3);
Should be:
MyLongClassName myLongVariable = someOtherLongCode(
    param1,
    param2,
    param3);
Comment 1 J. Longman CLA 2005-08-03 16:07:01 EDT
(In reply to comment #0)

IMHO, _both_ options should be available.

MY experience is that in the preview, it appears as (option 1):
MyLongClassName myLongVariable = someOtherLongCode(param1,
                                                   param2,
                                                   param3);

but when the code formatter runs, it is (option 2):
MyLongClassName myLongVariable = someOtherLongCode(
    param1,
    param2,
    param3);

Given that option 1 is closer to what my compadres produce with IntelliJ, I
would like to format that way.  (More explicitly, I would like to format
identically to IntelliJ)
Comment 2 Olivier Thomann CLA 2005-08-31 12:29:35 EDT
Both formatting are doable right now.
The first one:
MyLongClassName myLongVariable = someOtherLongCode(param1,
                                                   param2,
                                                   param3);
can be done by setting:
- tab char as MIXED or TAB
- use tabulation only for leading indents (see bug 97918)
- indent on column
- alignment for method invocation to WRAP_NEXT_PER_LINE

The second one:
MyLongClassName myLongVariable = someOtherLongCode(
    param1,
    param2,
    param3);

- indent on default
- continuation indent to 1
- alignment for method invocation to WRAP_ONE_PER_LINE

In this case you get two indents for param1, param2 and param3 instead of one.

Closing as FIXED.
Regression tests in
org.eclipse.jdt.core.tests.formatter.FormatterRegressionTests.test597/599.
Comment 3 Olivier Thomann CLA 2005-09-20 14:15:20 EDT
Reopen to close as WORKSFORME since no code has been changed to solve this PR.
Comment 4 Olivier Thomann CLA 2005-09-20 14:15:42 EDT
Closing.