Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Trim whitespace
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

tatou100
New Member

Canada
2 Posts

Posted - Oct 02 2009 :  1:19:29 PM  Show Profile  Reply with Quote
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.

feline
Whole Tomato Software

United Kingdom
18751 Posts

Posted - Oct 02 2009 :  2:35:53 PM  Show Profile  Reply with Quote
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.

zen is the art of being at one with the two'ness
Go to Top of Page

legalize
Tomato Guru

USA
119 Posts

Posted - Oct 02 2009 :  6:56:57 PM  Show Profile  Reply with Quote
In VS.NET, you can do this with Replace in Files...

Replace :b+$ with empty string.

http://legalizeadulthood.wordpress.com
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18751 Posts

Posted - Oct 03 2009 :  12:22:50 PM  Show Profile  Reply with Quote
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.

zen is the art of being at one with the two'ness
Go to Top of Page

tatou100
New Member

Canada
2 Posts

Posted - Oct 05 2009 :  12:24:23 PM  Show Profile  Reply with Quote
Thanks for your suggestion. We will try it this way :)
Go to Top of Page

legalize
Tomato Guru

USA
119 Posts

Posted - Oct 06 2009 :  4:52:04 PM  Show Profile  Reply with Quote
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.

http://legalizeadulthood.wordpress.com

Edited by - legalize on Oct 06 2009 4:52:29 PM
Go to Top of Page

almo
New Member

Canada
3 Posts

Posted - Nov 24 2015 :  10:13:06 AM  Show Profile  Reply with Quote
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.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18751 Posts

Posted - Nov 24 2015 :  7:33:40 PM  Show Profile  Reply with Quote
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.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000