2

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 someId,
                                            final Long anotherId, 
                                            final Long otherParam) {
        // Omitted
    }
4

1 回答 1

1

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

您可以保留所需的格式样式,而不是将参数格式化为一行: 在此处输入图像描述

于 2021-03-02T07:29:19.963 回答