Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Saturday, August 1, 2009 1:46 PM
There has to be a setting somewhere to remove, or not insert, any trailing whitespace from each code or comment line.
I am using VS2008/Sp1 and primarily coding in C# but this applies to any other language as well. I have gone through all the tools->Options->Text Editor options and nothing jumps out at me.
I thought that I had seen this option in some verion of Visual Studio
Scott
All replies (2)
Monday, August 3, 2009 4:05 AM âś…Answered | 1 vote
Hi Scott
Thanks for your feedback.
Actually, this issue has been filed at Add ability to trim trailing spaces (tabs) .
The workaround is recording a macro to do this:
In Find what: {:b}*\n
In Replace with: \n
In Find Options, check Use regular expressions.
Ctrl+Shift+R to record a temporary macro
Click Replace All
Ctrl+Shift+R to stop recording the macro
From now on Ctrl+shift+P (running temporary macro)will clean the trailing whitespace.
You can get macro menu at Tools > Macros .
For more information of regular expression usage in Visual Studio 2008, please visit http://msdn.microsoft.com/en-us/library/2k3te2cs.aspx
And there is also a forum post ever discussed this issue: http://forums.asp.net/p/955596/1174934.aspx
Hope the explanations about the reason why MS doesn't make it as a built-in function make sense to you :)
If there is some reason that you can't accept this workaround, please feel free to let me know.
Thanks!
Figo Fei
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact [email protected]
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Monday, August 3, 2009 4:52 PM | 1 vote
I can "kind of" see the objection to automatically truncating white space. Particularly for html and potentially other language, but I do not see a problem for the standard programming languages, (C# or VB).
I would really like to see an option, by editor, that would allow this.
Your macro worked great, I just don't think I should have to go through all that.
Thanks alot for your response. It works and I will live with that.
ScottScott