Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove tabs or spaces from empty lines

Tags:

phpstorm

I know PhpStorm allows the option to remove spaces at the end of a line.

Is it possible to configure it to remove tabs or spaces on empty lines?

Example: I type the following

if (1 == 1) {

Then I press enter twice, and I continue coding...

if (1 == 1) {

    savePlanet();

The empty line in the middle now has spaces, but I want just an empty line.

like image 688
zundi Avatar asked Mar 11 '23 16:03

zundi


1 Answers

You have 2 options here:

  1. Settings | Editor | General, Strip trailing spaces on Save - when it's set to All, all trailing spaces/tabs are removed on Save, including the ones on empty lines
  2. Settings | Editor | Code Style | <Your language> | Tabs and Indents, Keep indents on empty lines: when disabled, spaces/tabs on empty lines are removed on code reformatting
like image 151
lena Avatar answered Apr 05 '23 20:04

lena