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?
Please sign in to leave a comment.
Try press Enter.
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.
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.
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)
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.
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.
Hi John,
Strip trailing spaces on Save
Regards, Denis
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...
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
Ok, thanks!