I've never figured out how to make Intellij handle continuation indent for chained methods properly, and apparently today is the day it's annoyed me enough to consult you lovely people.
What I want is this:
makeAThing(
"with",
"params"
)
.setProperty("with some more params")
.start();
What I get is this:
makeAThing(
"with",
"params"
)
.setProperty("with some more params")
.start();
I get this in Java, Groovy, JavaScript and a bunch of other places. How can I persuade Intellij not to add continuation indent after a chained method call?
If you need to adjust indentation settings, in the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Editor | Code Style. On the appropriate language page, on the Tabs and Indents tab, specify the appropriate indents options and click OK.
IDEA has a “smart tabs” option that you can turn on: If this check box is selected, IntelliJ IDEA inserts tabs for indentation and reformatting, but fine alignment to a necessary column is done only via spaces. This is done in order to preserve visual representation of the source code, when the Tab Size is changed.
I just switched to intellij and also have found this rather annoying.
Only found two solutions:
Works for Java not sure for JS:
// @formatter:off
...
// @formatter:on
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With