问题描述:

Problem

I would like the lines with a closing brace/bracket/parenthesis to have exactly the same indent as the lines with the matching opening brace/bracket/parenthesis.

After some searching I guess that my needs are quite peculiar, but perhaps I'm just missing something. Is it possible to configure Eclipse auto-formatter to behave in such fashion? (I spent hours toggling checkboxes, but couldn't make it behave this way, so far.)

Example

In other words, I would Eclipse to format this:

public String concatenate(String a,

String b) {

...

}

in this way:

public String concatenate(

String a, String b

) {

...

}

// The same, but with some extra comments:

public String concatenate( // the line with "(" has no indent

String a, String b

) { // so, the line with the matching ")" also should not

...

} // same goes for {} and []

网友答案:

It looks like you should be able to do this in the Eclipse Neon Milestone 7 release (4.6M7) which has additions to the code formatter (see the 'New options for code formatter' section in the What's New and Noteworthy for the release).

Note: Milestone releases are early releases of Eclipse releases and might not be as stable as the final release (Eclipse Neon is due for release in June 2016).

相关阅读:
Top