问题描述
vscode 中哪个 eclipse-formatter 设置会完成下面的格式化,特别关注参数对齐?
当前
public ResponseEntity retrieveAgreement(final String one,final Long someId,final Long anotherId,final Long otherParam) {
// Omitted
}
需要
public ResponseEntity retrieveAgreement(final String one,final Long otherParam) {
// Omitted
}
解决方法
关于Java Formatting,可以参考Formatting and Linting。
下载 GoogleStyle.xml 并编辑以下设置:
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="1" />
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="false"/>
然后在 vscode settings.json 中,设置
"java.format.settings.url": "<local path to java-google-style.xml>",