Feature Requests item #970836, was opened at 2004-06-10 19:08
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=438938&aid=970836&group_id=44253
Category: Definitions (source editor)
Group: None
Status: Open
Priority: 4
Submitted By: Neal Horowitz (nrhorowitz)
Assigned to: Nobody/Anonymous (nobody)
Summary: Indent logic, 1.5
Initial Comment:
Specifically, I'm thinking about enums, in which a
comma-separated list of identifiers often spans
multiple lines. Currently, DrJava indents such
declarations as follows:
public enum MyEnum {
..MyEnumValue1,
....MyEnumValue2,
....MyEnumValue3
}
where clearly, the desirable indentation would be:
public enum MyEnum {
..MyEnumValue1,
..MyEnumValue2,
..MyEnumValue3
}
The reason, as I understand it, is that the reduced
model considers the list to be a single statement and
thus indents subsequent lines, as would be appropriate
for a list of variable declarations or an actual
multi-line statement. However, in this situation, it
is not a single statement but a list of essentially
independent values. I'm not sure if this is worth
correcting or what the best way to add logic for this
is, but it's pretty annoying for declaring enums with
members/longer constructors such that having multiple
lines is necessary.
As a side note, further members (fields, constructors,
or methods) are indented correctly -- since a semicolon
is required after the enums, DrJava effectively
considers the statement to be ended and restores the
single level of indentation. For example, the
following indentation shows the correct and incorrect
behavior:
public enum MyEnum {
..elt1("Some long string"), //
....elt2("Some other long string), // wrong,
indentation too deep
....elt3("The last string"); // still wrong
..private String _myString; // correct, since the list
was terminated by a semicolon
..MyEnum(String s) { //correct
...._myString = s; //still correct
..} // still good. You probably get the idea.
}
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=438938&aid=970836&group_id=44253
|