Whidbey indentation changes

I ran across this post recently which mentions that the default indentation character for Whidbey has changed from tabs to spaces for the default C# profile.  I'm not sure I like the sound of that. Now, I'll admit I'm a tab guy, not a space guy, but that's not my concern. Won't we end up with a mess of mixed indentation styles as we edit existing code? Sounds potentially very ugly. I realize that you can set the option back to tabs, but I'll bet most people won't.

8 Comments

  • I actually prefer spaces over tabs because it allows code to format "consistently" in editors other than Visual Studio.NET. For example, complex HTML created in VS.NET and using tabs don't always fare well when viewed in another editor (say Notepad). Tabs sometimes don't translate consistenly over multiple editors.



    I actually welcome the switch because whenever I do a fresh install of VS.NET, that's one of the first settings I change.

  • I figured I'd hear from a "space-r" pretty quickly. :)



    I'm not sure what you mean by "translate consistently". I realize that the amount of "space" a tab takes up can vary from editor to editor (Notepad is particularly bad with that), but the spacing is still consistent, so the formatting should still be consistent (different, but consistent).



    I prefer tabs to spaces primarily because I find it faster to navigate and indent/unindent code using tabs rather than spaces (in any editor, not just VS).



    But that really wasn't the point - it's the change of defaults that worries me. The inevitable mixed tab/space code that will result will be seriously ugly to deal with. At the very least I would like it if VS.NET made this readily apparent - maybe by asking me the first time I run it which option should be the default. Then if people pick space, so be it, but at least they won't blunder into it.

  • Should also have the option to convert spaces to tabs (eg: 4 spaces = 1 tab char), and vice versa in the current document/project.



    I would find that convenient as well. It'll also help you clear out all of the mixed tab/space code.

  • As I write this, my display name in MSN Messenger is :"Indent with spaces and die!"



    I prefer tabs. Even though I don't really think space-based indenting is inherently evil, most of the people I have encountered who do it, do it poorly.



    None of the programmers I work with use spaces and I think a lot of people will be annoyed about this change of default.

    Which customers did were you listening to for this one? :P

  • While I prefer spaces, I do agree that making a change to the default at this point is a bad idea. If it was a tab character in the last version, then it should be in the next.



    That being said .. anyone that uses tabs should be shot on site!

  • If tab is consistent on ALL editors, it would be great and then again it is not. I will this this change.

  • If you write a tab character to a source file, you are losing information (ie how much whitespace the tab represents).



    How the editor presents the indentation to the user doesn't really matter - it can show sequences of spaces as tabs according to taste.



    So I'd prefer that VS *always* converts tabs to spaces before saving.

  • I've become a fan of tabs for one simple reason: I can change the number of spaces they represnt in most good editors.



    I'm a big fan of four-space tabs, but that is not the same for everyone. I've been working with some code that used three spaces and I feel compelled to change them all to four (or just to a tab).



    In addition, when working in mixed projects (e.g. XML or HTML), the indentation can get pretty deep... it's handy to switch to two-space tabs while editing these.



    I agree with the feedback on Notepad. That's why I don't use it. Try out Notepad2 or TextPad as an alternative. These allow you to make the change.

Comments have been disabled for this content.