Today I went hunting in an XML file for an erroneous double space I knew was there.
I was horrified to see all those extra spaces there!!! Now this Visual Studio 2010 instance is just running the default setup with the productivity tools installed (Oh and I hit Ctrl+R, Ctrl+W to show the whitespace characters used)
That’s an 81KB XML file!
Now I’m a believer in tabs over spaces and full tab sized indents in all cases, to me it’s cleaner and reduces page weight.
So, open up Visual Studios options, Tools > Options and go to Text Editor > All Languages > Tabs. For me this is what I found….
Settings that were not consistent across all the file types and Spaces used as indents! Grrrr!!!!! So, a quick change of settings:
A quick Ctrl+A, Ctrl+K, Ctrl+F to re-format the file and things looks much tidier:
The file size came down to 80KB, so about a 1.25% savings, not a huge amount, but if you think about that over all of the code sitting in source control for a development company like ours that’s likely to be gigabytes worth of savings. Plus the double space in the file stood out nice and clearly!
Now that the preferences for VS are ‘fixed’ all of the files will get the ugly space based whitespace removed as they get worked on.
-Gavin
Tabs! NOOOOOOOOO, spaces FTW. They look consistent on all platforms/dev tools
The key really is a consistent approach across your solution. Which was one of the things that I noticed in VS, not all file types had the same settings.
Spaces vs. Tabs: Tabs every time for this guy, I work in a single environment.
If you’re working in a dev environment that doesn’t handle tabs WTF? Even notepad does tabs consistently…. (note consistently)
Definitely consistency is the way.
Its not that editors cant handle tabs its that tab sizing varies between them, so code doesn’t look the same across them
http://lostechies.com/jimmybogard/2012/03/07/tabs-versus-spaces-spaces-won/