Bug 37106 - Code Formatter: Option to double indent wrapped lines in if statments, etc.
Summary: Code Formatter: Option to double indent wrapped lines in if statments, etc.
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.0 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-30 13:27 EDT by Brian Bray CLA
Modified: 2003-10-14 07:22 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 Brian Bray CLA 2003-04-30 13:27:06 EDT
The java coding conventions specify double indenting wrapped lines for if
statements, methods, loops, etc. so that its easier to see where the body starts.

from: http://java.sun.com/docs/codeconv/html/CodeConventions.doc3.html#262

Line wrapping for if statements should generally use the 8-space rule, since
conventional (4 space) indentation makes seeing the body difficult. For example:

//DON'T USE THIS INDENTATION
if ((condition1 && condition2)
    || (condition3 && condition4)
    ||!(condition5 && condition6)) { //BAD WRAPS
    doSomethingAboutIt();            //MAKE THIS LINE EASY TO MISS
} 

//USE THIS INDENTATION INSTEAD
if ((condition1 && condition2)
        || (condition3 && condition4)
        ||!(condition5 && condition6)) {
    doSomethingAboutIt();
} 

//OR USE THIS
if ((condition1 && condition2) || (condition3 && condition4)
        ||!(condition5 && condition6)) {
    doSomethingAboutIt();
}
Comment 1 Dirk Baeumer CLA 2003-05-02 05:01:39 EDT
Formatter is JDT/Core
Comment 2 Olivier Thomann CLA 2003-10-03 10:27:38 EDT
This is improved with the new formatter.
Fixed and released in HEAD.
Regression test added.
Comment 3 David Audel CLA 2003-10-14 07:22:14 EDT
Verified.