[英]Vscode eclipse formatter setting to align method parameters
vscode中哪个eclipse-formatter设置会完成下面的格式化,特别关注参数alignment?
当前的
public ResponseEntity retrieveAgreement(final String one, final Long someId,
final Long anotherId, final Long otherPAram) {
// Omitted
}
想要的
public ResponseEntity retrieveAgreement(final String one,
final Long someId,
final Long anotherId,
final Long otherParam) {
// Omitted
}
此设置有助于实现所需的 alignment 格式。
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="18"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="18"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="18"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="18"/>
关于 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>",
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.