ra4king
ra4king

Reputation: 594

Indent blank lines (IntelliJ IDEA)

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.

Upvotes: 22

Views: 5475

Answers (4)

Sergey Belonozhko
Sergey Belonozhko

Reputation: 549

Try this option: File->Settings->Editor->CodeStyle. Find and enable checkbox "Keep indents on empty lines" there . (available on my intellij idea 14.0.2)

screenshot: https://i.sstatic.net/xYahU.png

Upvotes: 0

bisgardo
bisgardo

Reputation: 4600

Though I can't seem to make it work as of IntelliJ 14.0.3, there does seem to be an option for this: Keep indents on empty lines.

Upvotes: 1

Michael Francis
Michael Francis

Reputation: 8737

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.

Upvotes: 15

yole
yole

Reputation: 97133

The IntelliJ IDEA formatter does not indent blank lines and does not provide any option to do so.

Upvotes: 5

Related Questions