Remove trailing spaces only from blank lines
How can I remove trailing spaces from blank lines using reformat code or on save?
I don't want them to be removed from no blank lines as it seems to happen by activating "Strip trailing spaces on Save", because for example 4 trailing spaces are used to created a linebreak in Markdown.
Please sign in to leave a comment.
Hi there,
Well ... for Markdown it should be working OK if you are using Markdown plugin by JetBrains -- see this comment.
If it's still does not do -- try via .editorconfig file (you will need EditorConfig plugin installed and enabled (NOTE: settings from such file will override your Code Style))
The idea is -- disable such stripping trailing spaces for *.md files (voiced in the same ticket). It used to work in the past (where IDE's Strip Trailing Spaces worked a bit differently) so hopefully will still work even now.
Thanks, will try that.
Looks like "Strip trailing spaces on Save" only works when hitting CTRL+S but not for auto save. I also tried trim_trailing_whitespace=true in .editorconfig for .js explicitely but it isn't used when running "reformat code" while tabs/spacing settings from .editorconfig are applied.
Looks like it took a moment for WebStorm to parse the .editorconfig. Now it works using .editorconfig which is my preferred solution. Thanks again.