Tacodiva
Tacodiva

Reputation: 518

VSCode Java Formatter don't linebreak when brackets omitted

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.

Upvotes: 0

Views: 146

Answers (1)

Shi Chen
Shi Chen

Reputation: 56

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.

Upvotes: 1

Related Questions