在 VSCode 中将选项卡大小/空间大小设置为默认值

Huy*_* Le 1 html css visual-studio-code vscode-settings

我目前正在使用 VSCode,但我遇到了这个问题。我想将每个项目的空间大小设置为 1,标签大小等于 2 作为默认值。但它仍然设置为空格:每个项目 4 个。当我设置空格 = 2 时,并运行 Beautify 文件。空间 = 2 时一切看起来都不错。然后我点击保存,将我的文件格式化为缩进大小 4。如何将其设置为默认值等于 2 个人?

静止空间:4

即使我更改了用户设置

在此处输入图片说明

小智 5

默认情况下,VSCode 会尝试检测文件的缩进选项。所以将 editor.detectIndentation 设置为 false

// When opening a file, `editor.tabSize` and `editor.insertSpaces` will be detected based on the file contents.
  "editor.detectIndentation": false,
Run Code Online (Sandbox Code Playgroud)