IntelliJ IDEA - line wrapping without breaking in the middle of a method call

Viewed 329

Is there an option in IDEA to stop the code formatter (for Java code) from breaking long lines at inappropriate places, specifically I am finding that it will place the line break between a method call and its opening bracket, e.g.

Collection<Thing> things = Arrays.asList(Something.getThings("Foo", foo.bar()), x, y, z);

becomes:

Collection<Thing> things = Arrays.asList(Something.getThings("Foo", foo.bar
        ()), x, y, z);

if it happens to cross the line length boundary.

I know I could refactor this particular code sample to not have the method call inline, but as a more general question can IDEA be configured to be smarter at placing the line break? Ideally I would rather this gets split to:

Collection<Thing> things = Arrays.asList(Something.getThings("Foo", 
        foo.bar()), x, y, z);
0 Answers
Related