问题
我希望带有结束大括号/方括号/圆括号的行与行<具有完全相同的缩进/strong> 与匹配的开口大括号/方括号/圆括号。
经过一些搜索,我猜我的需求很特殊,但也许我只是遗漏了一些东西。是否可以将 Eclipse 自动格式化程序配置为以这种方式运行? (我花了几个小时来切换复选框,但到目前为止还不能让它以这种方式运行。)
例子
换句话说,我将 Eclipse 格式化为:
public String concatenate(String a,
String b) {
...
}
这样:
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 []
最佳答案
看起来您应该能够在 Eclipse Neon Milestone 7 版本 (4.6M7) 中执行此操作,该版本添加了代码格式化程序(请参阅 What's New and Noteworthy 中的“代码格式化程序的新选项”部分了解该版本).
注意:里程碑版本是 Eclipse 版本的早期版本,可能不如最终版本稳定(Eclipse Neon 将于 2016 年 6 月发布)。
关于java - 将行与左括号和右括号对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36963330/