2

问题

我希望带有大括号/括号/括号的与带有匹配的左大括号/括号/括号的具有完全相同的缩进

经过一番搜索,我猜我的需求很奇特,但也许我只是错过了一些东西。是否可以将 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 []
4

1 回答 1

1

看起来您应该能够在 Eclipse Neon Milestone 7 版本 (4.6M7) 中执行此操作,该版本增加了代码格式化程序(请参阅该版本的新增功能和值得注意的“代码格式化程序的新选项”部分)。

注意:里程碑版本是 Eclipse 版本的早期版本,可能不如最终版本稳定(Eclipse Neon 将于 2016 年 6 月发布)。

于 2016-05-01T08:10:43.473 回答