'Control indentation in Java multiline method calls in IntelliJ
IntelliJ seems to only have two configurations for multiline method call parameters. They either appear like this:
Or this:
This is controlled using the "Editor -> Code Style -> Java -> Wrapping and Braces -> Method call arguments -> Align when multiline" option. However, I have not found any settings to achieve my actual preferred formatting, this:
That would not be quite as infuriating if pressing backspace in the editor didn't delete the entire line break, instead of just the tabs, but preferably I'd like to be able to control how many tabs are used, i.e. only one more than the method call declaration itself. Any help towards this would be enormously appreciated.
Solution 1:[1]
I believe what you're looking for is the "Continuation Indent" (Editor -> Code Style -> Tabs and Indents -> Continuation Indent. When "Align when multiline" is disabled, it uses this indent size (and it appears that you have the default of 8).
When I reformat with this setting I get:
foo.foo().bar("arg1",
"arg2");
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mark Peters |