Visual Studio 代码缩进配置和 EditorConfig?

Visual Studio Code Indent Configuration & EditorConfig?

我正在使用 Visual Studio 代码开发 Node.js 应用程序。 我已经浏览了他们在编辑器中配置缩进 space 的文档,但我找不到它。我用过 Sublime Text,所以我习惯了那个选项。

如何为 Visual Studio 代码配置 .editorconfig 文件?

转到 File -> Preferences -> User Settings|Workspace Settings 并添加这样的代码

{
  ...
  "editor.tabSize": 2, // Controls the rendering size of tabs in characters. Accepted values: "auto", 2, 4, 6, etc. If set to "auto", the value will be guessed when a file is opened.
  "editor.insertSpaces": true, // Controls if the editor will insert spaces for tabs. Accepted values:  "auto", true, false. If set to "auto", the value will be guessed when a file is opened.
  ...
}

您可以在 https://github.com/editorconfig/editorconfig-vscode

获得 .editorconfig 支持插件