Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vscode eclipse formatter setting to align method parameters

Which eclipse-formatter setting in vscode will accomplish the following formatting, focusing specifically on the parameter alignment?

Current

    public ResponseEntity retrieveAgreement(final String one, final Long someId,
            final Long anotherId, final Long otherPAram) {
        // Omitted
    }

Desired

    public ResponseEntity retrieveAgreement(final String one, 
                                            final Long someId,
                                            final Long anotherId, 
                                            final Long otherParam) {
        // Omitted
    }
like image 689
Albert Scholtz Avatar asked Oct 29 '25 04:10

Albert Scholtz


1 Answers

About Java Formatting, you can refer to Formatting and Linting.

Download GoogleStyle.xml and edit the following settings:

<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="1" />
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="false"/>

Then in vscode settings.json, set

"java.format.settings.url": "<local path to java-google-style.xml>",

You can keep the formatting style that you want instead of parameters being formatted to one line: enter image description here

like image 105
Molly Wang-MSFT Avatar answered Oct 31 '25 18:10

Molly Wang-MSFT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!