Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 154621 - [typing] Ctrl-I (Correct indentation) re-indentation of string argument to method call is incorrect.
Summary: [typing] Ctrl-I (Correct indentation) re-indentation of string argument to me...
Status: RESOLVED DUPLICATE of bug 75573
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.2   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-21 18:11 EDT by Gary CLA
Modified: 2006-08-22 03:19 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 Gary CLA 2006-08-21 18:11:47 EDT
Type in two lines of code that look like this into a Java unit:

    xxx(
        yyy, "zzz");

Position your text cursor so that it is immediately in front of the first " of the string.  Press the Enter/Return key.  You will now have this:

    xxx(
        yyy,
        "zzz");

which is fine.  Now type Ctrl-I (or the "Correct indentation" item on the Source menu).  You will now have this:

    xxx(
        yyy,
    "zzz");

Interestingly enough if you add an unnecessary '+ ""' to the string expression, the indentation does not change.

This:
    xxx(
        yyy, "zzz" + "");
changes to:
    xxx(
        yyy,
        "zzz" + "");
and stays that way even after the Ctrl-I is typed.

Under the Java preferences for Java > Code Style > Formatter I am using these "Settings for arguments": "Line wrapping poliy" is "Wrap only when necessary" and "Indentation policy" is "Indent by one"
Comment 1 Dani Megert CLA 2006-08-22 03:19:00 EDT

*** This bug has been marked as a duplicate of 75573 ***