Keeping whitespace (tabs) in blank lines based on indentation?

Answered

Is there any way to keep whitespace on blank lines according the indentation rules? (see the screenshot for where I want to keep whitespace) I've searched through all the settings and can't find the option. This gets really annoying when navigating your code with the up/down arrows and having to hit tab two or three times to go to where you want. Or, maybe you could just auto-generate the whitespace when you move the cursor up/down with the arrows and then remove it if you don't type anything?
keeping-whitespace-question.png

0
11 comments
Avatar
Permanently deleted user

Try press Enter.

0

I'm talking about code that has already been written that has "kept" blank lines. I know about Enter or Shift+Enter for "Start New Line", but that doesn't help my question.

0
Avatar
Permanently deleted user

You don't want whitespace on empty lines ;)

What you want is to turn on Code Style -> Editor ->  Allow Placement of caret after end of line.

0

Not really, because if I press the "down" arrow at the end of a line above a blank line, that option will just take me straight down in that column (rather than bumping back to where the indented space would be)

0
Avatar
Permanently deleted user

Ah now I get you... and also wondered why I don't have that problem. Pressing End on empty lines puts the caret on the proper indentation column.

0

Yes, I knew that you could press "end" too. I'm really looking for a solution where you don't have to press anything other than up/down and landing on the line.

0
Avatar
Permanently deleted user

Hi John,

Strip trailing spaces on Save

Regards, Denis

0

Thanks Denis, that seems to work by keeping the whitespace while editing the file.

Is there any way to keep the whitespace (I guess it would be generating whitespace) for a file that already has many blank lines?

Ideally, it would be a checkbox in settings->code style->blank lines called something like "force indentation whitespace" so that I could simply reformat all my files...

0
Avatar
Permanently deleted user

Hi John,

Unfortunately there is no such option at the moment. Feel free to submit corresponding request but I doubt that it is done for IJ X.

Regards, Denis

0

Please sign in to leave a comment.