T O P I C R E V I E W |
tatou100 |
Posted - Oct 02 2009 : 1:19:29 PM It would be a nice feature to add the possibility to trim trailing whitespace when a file is saved. That's something that most text editor do and visual studio don't. |
7 L A T E S T R E P L I E S (Newest First) |
feline |
Posted - Nov 24 2015 : 7:33:40 PM Unfortunately we still don't have any plans to add this feature to VA. We are focussing more on refactoring and other features and bug fixes that directly effect code editing.
This is getting into the area of code formatting. It's something people are interested in, but just about everyone who is interested wants something different. |
almo |
Posted - Nov 24 2015 : 10:13:06 AM I want this feature in Visual Assist. It's not a default option in VS (still), and I don't want to have to download a plugin just to take care of this basic thing that even freeware text editors deal with.
And no, I don't want to have to search and replace something to do this. I should be able to have this automatically. |
legalize |
Posted - Oct 06 2009 : 4:52:04 PM Macros in VS.NET are compiled VB.NET code. The first time you run the macro its first compiling the macro to MSIL and then JIT compiling that to native code. Subsequent macro runs are fast because it uses the already JIT compiled code for the macro.
If a Macro is too slow, you could create an add-in that monitors the file save event and trims trailing whitespace right before save.
However, I just periodically purge trailing whitespace from files I'm editing with the Replace in Files regex that I posted earlier. The whitespace has a tendency to come back slowly, mostly because of auto-indenting leaving leading tabs on empty lines.
Once you purge the trailing whitespace globally from your solution, you shouldn't have to purge it too often after that. I do global purges of trailing whitespace and commit the changes as a single isolated commit across the whole project, usually with a log message of "crush trailing whitespace" or something similar.
I've never found it to be so frequent a problem that I even bothered coding a VS.NET macro for it. |
tatou100 |
Posted - Oct 05 2009 : 12:24:23 PM Thanks for your suggestion. We will try it this way :) |
feline |
Posted - Oct 03 2009 : 12:22:50 PM I did consider suggesting an IDE macro that uses find and replace, but then you would have to manually trigger the macro every time you wanted to run it. There might be some performance issues here, since for me the first time I trigger an IDE macro after loading the IDE it takes ages to run. Subsequent runs of the same macro are fast. |
legalize |
Posted - Oct 02 2009 : 6:56:57 PM In VS.NET, you can do this with Replace in Files...
Replace :b+$ with empty string.
|
feline |
Posted - Oct 02 2009 : 2:35:53 PM This is not really something VA is going to do, but you could use a command line utility to do this, and set it as a custom build step, so all files have their white space trimmed before compiling. |