PHPStorm reformat - how do I disable removing spaces in empty lines?

Fluffy picture Fluffy · Jun 3, 2014 · Viewed 9.8k times · Source

When reformatting a file, phpstorm replaces empty lines with whitespace to just empty lines, e.g. ^[tab][tab]$ to ^$. How do I disable this?

Answer

LazyOne picture LazyOne · Jun 3, 2014

You cannot -- http://youtrack.jetbrains.com/issue/IDEA-73161

I was thinking that disabling stripping whitespace characters altogether would do the job (Settings | Editor | Strip trailing spaces on Save) .. but apparently it only works on "Save".

Related tickets:


Now you can do that on code reformat as well:

  1. Settings/Preferences
  2. Editor | Code Style
  3. $language$ | Tabs and Indents | Keep indents on empty lines check box

(this option was introduced after this answer was provided: https://youtrack.jetbrains.com/issue/IDEA-103941#comment=27-807213)