Closed NN--- closed 5 years ago
I've always been reluctant to add this feature. I think when it comes to formatting code, making your actions deliberate is underrated.
The idea that I might add a single character and then when I go to check in find that 100 lines has been changed seems wrong to me.
Obviously this could be an option, but considering how simple this extension is, that's adding a lot of complexity.
I would prefer it to trim as the file is closed. I often save mid-thought, which means the trailing spaces are still wanted at that point in time, at least on the current line.
The "Mid-thought Save" is a great example of an unforeseen consequence of making this an implict action over keeping it as a deliberate action. I'm also not sold on doing it on close. By nature that's very hidden and removes the ability to "Undo" the action.
I'm going to close this issue as I think it's out of scope for this extension.
Happy for someone else to clone the repository and make their own version with this feature (I'm terrible at putting the licencing on my repositories, I'll try to get around to it soon, but it's all under the MIT licence)
Just add handler to Dte.Events.DocumentEvents.DocumentSaved .
Note: The handler must be a class field, otherwise it will not work properly.