Home > database >  VSCode Java Formatter don't linebreak when brackets omitted
VSCode Java Formatter don't linebreak when brackets omitted

Time:11-23

When I type an if statement on one line

if (root == null) return null

VSCode's formatter is putting a linebreak, turning the above into

if (root == null)
    return null;

How do I configure the formatter to leave statements like these on one line? I have gone through all the settings in java-formatter.xmland can't find one that sounds like it's talking about this.

CodePudding user response:

you can find a setting in java-formatter.xml:

org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line

set it to true and try to re-format your source file.

  • Related