Answered by:
How do you stop visual studio 2012 trimming white space at the end of each line

Question
-
User-2087996274 posted
this is really giving me headaches, ever since I installed the last update visual studio2012 keeps removing white space at the end of each line when I save a file.
I'm working on a team project where code changes are reviewed that gives reviewers hard time for so many changes made turn out to be white space
I can't find any setting that turns this feature off, there're some posts online mentioning about injecting a piece of macro in the IDE to stop this from happening. Seriously? if this is true, I can't believe Microsoft delivers such a bad feature that there's no easy way to turn it off..
Can anyone help me out please?
please note it's Visual studio 2012Tuesday, June 10, 2014 1:57 AM
Answers
-
User-1454326058 posted
Hi walterh,
I can’t reproduce that scene.
Do you install any plug-in or tools for VS? If so, I suggest that you should to check whether the issue is cause by them.
On the other hand, I suggest that you could reset the setting. (Tools=>Import and Export Settings Wizard=>Reset all settings)
If it still have the issue, I suggest that you could repair your VS and check the result.
Thanks
Best Regards
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, June 11, 2014 5:09 AM -
User2053451246 posted
Do you have Productivity Power Tools installed? Check Tools -> Options -> Productivity Power Tools -> PowerCommands: General. I believe the option Format document on save would cause this.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, June 12, 2014 3:41 PM
All replies
-
User1508394307 posted
It could be due to formatting feature (Format Selection or Format Document from the Edit menu). A formatting will remove a space after ; (in my case it's a .cs file). By default it also run automatically
- on ;
- on }
- on paste
and can be changed in Tools - Options - Text Editor - C# - Formatting - General
It does not change anything on Save. At least I tried it and for me it does not change anything.
Tuesday, June 10, 2014 2:35 AM -
User-2087996274 posted
^thanks for the reply
but it's a diffrent issue, I do need those formatting features such as formatting on ;
the exact issue that Im experiencing is when I save a file, it reformats the entire file by removing trialing white space of each line, I happened to work on a file that contained roughly 800 lines of code, and I only made a few small changes on one of the functions, yet after saving the file, it showed more than a half of the file was changed. it gives the reviewer a bad time altho indeed he can add w=-1 in github url to eliminate white space but it's not an ideal solution because I am the only "lucky" guy who installed the darn update, it makes me look bad to be the only guy who requires special care. I can't blame my team lead gets annoyed because this becomes an chronic issue.
now I'm just hoping I missed the easy setting somewhere in vs2012 that can turn off this feature
Tuesday, June 10, 2014 3:49 AM -
User1508394307 posted
I understand it and as I mentioned above it does not change anything for me on Save.
One thing just came to my mind is that there is an option at
Environment->Documents->Check for consistent line endings on load
that checks if file was edited on different operating systems (or previously saved with different settings for line endings). Usually I think it alerts about it when opening such file.
Check if you have that option selected and try to unselect it and open-save again to see if it does change anything.
Tuesday, June 10, 2014 4:20 AM -
User-2087996274 posted
yea, I tried that, didn't make any difference.
Tuesday, June 10, 2014 4:47 PM -
User-1454326058 posted
Hi walterh,
I can’t reproduce that scene.
Do you install any plug-in or tools for VS? If so, I suggest that you should to check whether the issue is cause by them.
On the other hand, I suggest that you could reset the setting. (Tools=>Import and Export Settings Wizard=>Reset all settings)
If it still have the issue, I suggest that you could repair your VS and check the result.
Thanks
Best Regards
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, June 11, 2014 5:09 AM -
User2053451246 posted
Do you have Productivity Power Tools installed? Check Tools -> Options -> Productivity Power Tools -> PowerCommands: General. I believe the option Format document on save would cause this.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, June 12, 2014 3:41 PM