如何在vscode中更改tabSize和insertSpaces

Pat*_*lac 2 whitespace indentation visual-studio-code

你如何实际更改vscode的"editor.tabSize"和"editor.insertSpaces"值?我打开了文件>首选项>用户设置并添加了:

// Place your settings in this file to overwrite the default settings
{
// Controls the rendering size of tabs in characters. If set to auto, the value will be guessed based on the opened file.
"editor.tabSize": 4,

// Controls if the editor will insert spaces for tabs. If set to auto, the value will be guessed based on the opened file.
"editor.insertSpaces": true,
}
Run Code Online (Sandbox Code Playgroud)

但是,当我打开一个带有两个空格标签的html文件时,按Tab键会插入两个空格,当我打开一个使用\ t标签的文件时,按Tab键插入\ t.

我做错了什么导致vscode不尊重我的设置?

Ben*_*ero 6

您的代码段中有一个尾随逗号,目前VSCode无法理解格式错误的JSON设置.我很高兴地说,随着下一次更新,这个问题应该修复:)!

设置的工作版本是:

// Place your settings in this file to overwrite the default settings
{
// Controls the rendering size of tabs in characters. If set to auto, the value will be guessed based on the opened file.
"editor.tabSize": 4,

// Controls if the editor will insert spaces for tabs. If set to auto, the value will be guessed based on the opened file.
"editor.insertSpaces": true
}
Run Code Online (Sandbox Code Playgroud)