cpmcgrath / TrimLineEnds

Visual Studio Extension which trims blanks space from the end of lines
http://visualstudiogallery.msdn.microsoft.com/cc562125-6235-4082-b670-e0ed496b18a4
10 stars 8 forks source link

Trim automatically on save #5

Closed NN--- closed 5 years ago

NN--- commented 7 years ago

Just add handler to Dte.Events.DocumentEvents.DocumentSaved .

Note: The handler must be a class field, otherwise it will not work properly.

cpmcgrath commented 7 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.

michaelcsikos commented 7 years ago

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.

cpmcgrath commented 7 years ago

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.

cpmcgrath commented 5 years ago

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)