How do I turn off right-paren on its own line in IntelliJ IDEA with EditorConfig in Java?

Viewed 116

I am using Intellij IDEA 2020.3.1 for Java work. We have a project requirement to use EditorConfig to define code style, and Intellij is therefore set to have EditorConfig settings override settings in the editor preferences.

I am trying (and failing) to figure out how to have the closing parenthesis of a multi-line method call NOT be on its own line.

In other words, I want

foo(
    a,
    b,
    c);

and NOT

foo(
    a,
    b,
    c
);

I have tried a whole bunch of settings in the .editorconfig file that look promising, but have had no luck.

I thought that this would do the trick but it didn't work.

ij_java_call_parameters_right_paren_on_new_line = false

So which Intellij IDEA EditorConfig settings will do the trick?

Also, is there a list anywhere of all the EditorConfig settings that Intellij IDEA supports and their definitions?

1 Answers

You are very close. I think the call argument wrapping and new line after left parenthesis is what you are after.

Here are the fields I updated in .editorconfig for this.

ij_java_call_parameters_new_line_after_left_paren = true
ij_java_call_parameters_wrap = split_into_lines

The resulting code after formatting looks as below;

 public class Foo {
    public static void storm(int w, int x, int y, int z) {
        System.out.println("w = " + w + ", x = " + x + ", y = " + y + ", z = " + z);
    }

    public static void main(String[] args) {
        storm(
                1,
                2,
                4,
                5);
    }
}

Related