VS代码格式代码键盘快捷键弄乱了C#空格
我一直在想这个问题。我的工作区设置如下所示:VS代码格式代码键盘快捷键弄乱了C#空格,c#,format,visual-studio-code,C#,Format,Visual Studio Code,我一直在想这个问题。我的工作区设置如下所示: { "files.trimTrailingWhitespace": true, "files.autoSave": "afterDelay", "files.autoSaveDelay": 1000, "files.exclude": { "**/.git": true, "**/.DS_Store": true, // hide js when typscript file pre
{
"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。谢谢。我也遇到了同样的问题,在使用其他扩展名的.cs文件时出现的问题很正常。我认为这是一个问题,我记得不久前读过,但找不到github帖子。