IntelliJ IDEA - wrap lines without breaking in the middle of a method call

Is there an option in IDEA to stop code formatting (for Java code) from breaking long lines in inappropriate places, in particular, I find that it will put a line break between the method call and its opening bracket, for example

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 crosses the line length boundary.

I know that I could reorganize this sample code to not have a built-in method invocation method, but since a more general question can IDEA be configured to be smarter when placing a line break? Ideally, I would prefer this divided into:

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

Source: https://habr.com/ru/post/1268357/


All Articles