Description
I just opened a file in a project that uses trim_trailing_whitespace=true
. I made some changes to the file, and after saving it found that all lines had been stripped of trailing whitespace, not just the ones that I touched.
This is of course very annoying when you have files in version control, where you do not want to be faced with a lot of unrelated changes (of course files should be ok in the repo to begin with, but it's not an ideal world we live in).
It seems this is also the intention of the editorconfig spec. Their FAQ says:
Existing files are not reformatted. Only newly input lines are formatted in the format given in the .editorconfig files. If you are looking for a tool to check or/and reformat your existing files, check editorconfig-tools, eclint and editorconfig-cf (none of them work perfectly though).
Could something like this be implemented? Perhaps the current behaviour could be enabled by an option (or an explicit command that does a one-off run to fix all formatting)?
Activity