skip to Main Content

VSCode opens new files in Tabs mode (bottom status line shows "Tab Size") even though I have setting "Insert Spaces" on and "Detect Indentation" off. How can I change this?

2

Answers


  1. Workspace-Specific settings (VS Code)

    Check if you have .vscode/settings.json in your project folder.

    .vscode/settings.json file:

    {
      "editor.insertSpaces": true,
      "editor.tabSize": 3
    }
    

    .editorconfig file

    This file can exist at the root of your project (for project-specific settings) or in your user’s home directory (for user-wide preferences).
    This can override any editor-specific settings and enforce consistent indentation rules across all supported editors and IDEs.

    .editorconfig file:

    # .editorconfig
    root = true
    
    [*]
    indent_style = space
    indent_size = 3
    
    Login or Signup to reply.
  2. 关闭自动检测文件内容,即可默认使用空格,设置里面的 Editor: Detect Indentation

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search