我一直在努力想出这个 . 我的工作区设置如下:

{
    "files.trimTrailingWhitespace": true,
    "files.autoSave": "afterDelay",
    "files.autoSaveDelay": 1000,
    "files.exclude": {
      "**/.git": true,
      "**/.DS_Store": true,
      // hide js when typscript file present
      "**/*.js": {"when": "$(basename).ts"}
    },
    "editor.formatOnType": true,
    "editor.referenceInfos": false,
    "editor.wrappingColumn": 0,
    "editor.tabSize": 2,
    "editor.detectIndentation": false
}

当我转到C#文件中的新行时,它会自动缩进2个空格 . 但是当我执行格式代码键盘快捷键(Windows上的SHIFT ALT F)时,它会将代码缩进为整个文件的4个空格 . 有很多设置,所以我可能错过了我需要设置的自动格式才能正常工作 . 如何让自动格式化所有2个空格?要确认我的设置,请在编辑器底部输入 Spaces:2 . 谢谢 .