I'd like to set the IDEA formatter to keep indentations on blank lines. Currently when I reformat my source files, it strips all indents on blank lines.
I could not find anything on Google nor could I find a setting in the formatter.
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.
You can configure IntelliJ IDEA to detect the indentation style in the current file and use this style instead of the indents specified in the code style settings for a specific language. Press Ctrl+Alt+S to open the IDE settings and select Editor | Code Style.
In IntelliJ IDEA, to convert existing tabs to spaces or vice versa, use File → Edit → Convert Indents → To Spaces (or To Tabs). The Reformat code shortcut Ctrl + Alt + L will also do this, while applying other changes.
You can't make IntelliJ IDEA add indentation to blank lines, but you can prevent it from removing them, as shown in this answer to this question.
Settings | Editor | Strip trailing spaces on Save -> None.
The IntelliJ IDEA formatter does not indent blank lines and does not provide any option to do so.
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