微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

用于对齐方法参数的 vscode eclipse 格式化程序设置

如何解决用于对齐方法参数的 vscode eclipse 格式化程序设置

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>",

您可以保留所需的格式样式,而不是将参数格式化为一行: enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。