Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2013 is inserting tabs instead of spaces

I have set Visual Studio 2013 to "Insert spaces" in Tools -> Options -> Text Editor -> All Languages -> Tabs. The settings for Text Editor -> C# -> Tabs is also set to "Insert spaces". When I open up a C# file and use the tab key then VS is keeping the tab instead of inserting spaces. If I go back into Tools -> Options -> Text Editor -> C# -> Tabs and switch to "Keep tabs", click OK and then go back in and change it back to "Insert spaces" then VS starts using spaces. If I close VS and open up a C# file VS is using tabs again. I have to go back in and select "Keep tabs", click OK and then go back in and change it back to "Insert spaces" for it to work again.

Additionally, when VS is keeping the tabs if I complete a statement with a semicolon or close a block with a brace then the tabs which VS was using are then replaced with spaces. Or if I do a code reformat then it will change all the tabs to spaces. Any ideas as to why VS is initialing using tabs?

Also, I am using Resharper. Resharper is also set to use spaces. When I suspend Resharper I experience the exact same behavior in VS, so I don't think Resharper is causing the issue.

like image 332
chris Avatar asked Nov 11 '22 09:11

chris


1 Answers

In my case the culprit was another extension, VsVim. I suppose the first step in troubleshooting this should be disabling all extensions and if that resolves the isse then re-enabling them one at a time to determine the offending extension. To resolve the issue with VsVim expandtab can be turned on: :set expandtab.

like image 196
chris Avatar answered Dec 23 '22 13:12

chris