1

How do we configure intellij code style so that when reformating code

instead of this:

enter image description here

we get this: enter image description here

3
  • There's a great talk explaining, among other things, why the current style makes more sense than the style that you want to change it to: vimeo.com/97329157 Commented Mar 9, 2015 at 8:24
  • However is this possible? Commented Mar 9, 2015 at 8:29
  • Your question is only concerning java? Commented Mar 9, 2015 at 9:31

1 Answer 1

2

While working with method chaining (for example builders), you can override the default behavior of intellij idea to align chained methods. This way, in my opinion, the code is much more readable. I think you should consider it as an alternative to your proposed solution.

Settings -> Editor -> Code Style -> Java -> Wrapping and Braces -> Chained Method Calls -> Align when multiline

BEFORE

enter image description here

AFTER

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

Not exactly what i intended, but those settings are what i was looking for.
Great. This becomes more important as java 8 stream often has many chaining methods.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.