Question

I use Visual Studio as my development environment, and tab indentation is 4, but after I commit to Google Code, the indentation is 8 in the browser, which makes my code look ugly.

Does anyone know how to reset the tab indentation to 4 when looking at it in web browser?

Was it helpful?

Solution

Apparently this is not supported. This enhancement request was filed nearly 5 years ago, and is still marked as "won't fix":

If you rely on tabs to be some width other than 8 spaces for your code to be formatted correctly, then other contributors will have trouble reading your code. If you do prefer hard tabs, it's good practice to use spaces (not tabs) for any formatting/alignment other than plain indentation: that way, your code will look all right no matter what the tab width.

I don't see us taking action on this in the foreseeable future: it would be adding complexity to project administration to enable something that really isn't such a great idea anyway.

artdent

So it looks like you are out of luck. I guess that's what you get for using tabs instead of spaces. Tabs require far too much support from the editor, and high quality editors are sadly still not ubiquitous.

It is trivial to configure Visual Studio to use spaces everywhere instead of tabs, including when you press the Tab key: Tools → Options → Text Editor → <language> → Tabs → Insert Spaces

  

If you don't want to use spaces everywhere, you could set up your source control system to convert tabs to spaces when you commit code, and convert the spaces back to tabs when you check out. Sounds like a lot of effort just to work around the limitations of one of your tools, but it wouldn't be that hard in practice once you got it set up.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top