Visual Studio replace tab with 4 spaces?

后端 未结 5 954
别跟我提以往
别跟我提以往 2020-12-22 17:15

Is there a way to set TAB button to work as 4 spaces in Visual Studio 2010 instead of going to Edit->Advanced->Untabify Selected Lines?

相关标签:
5条回答
  • 2020-12-22 17:26

    If you don't see the formatting option, you can do Tools->Import and Export settings to import the missing one.

    0 讨论(0)
  • 2020-12-22 17:29

    You can edit this behavior in:

    Tools->Options->Text Editor->All Languages->Tabs
    

    Change Tab to use "Insert Spaces" instead of "Keep Tabs".

    Note you can also specify this per language if you wish to have different behavior in a specific language.

    0 讨论(0)
  • 2020-12-22 17:44

    For VS2010 and above (VS2010 needs a plugin). If you have checked/set the options of the tab size in Visual Studio but it still won't work. Then check if you have a .editorconfig file in your project! This will override the Visual Studio settings. Edit the tab-size in that file.

    This can happen if you install an Angular application in your project with the Angular-Cli.

    See MSDN blog

    0 讨论(0)
  • 2020-12-22 17:49

    First set in the following path Tools->Options->Text Editor->All Languages->Tabs if still didn't work modify as mentioned below Go to Edit->Advanced->Set Indentation ->Spaces

    0 讨论(0)
  • 2020-12-22 17:51

    None of these answer were working for me on my macbook pro. So what i had to do was go to:

    Preferences -> Source Code -> Code Formatting -> C# source code.

    From here I could change my style and spacing tabs etc. This is the only project i have where the lead developer has different formatting than i do. It was a pain in the butt that my IDE would format my code different than theirs.

    0 讨论(0)
提交回复
热议问题