whitespace - 如何在vscode中更改tabSize和insertSpaces

标签 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,
}


但是,当我打开带有两个空格标签的html文件时,按tab插入两个空格,而当我打开使用\ t标签的文件时,按tab插入\ t。

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

最佳答案

您的代码段中有一个逗号结尾,并且当前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
}

关于whitespace - 如何在vscode中更改tabSize和insertSpaces,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30126059/

相关文章:

html - 边距空白

sql - 为什么ORACLE在命令中不允许连续的换行符?

c - C 程序如何将空格参数传递给 libc system(3) 调用?

Java DocumentBuilder - XML 文件中的错误缩进

python - 有人可以告诉我为什么我会收到意外的缩进错误吗?

java - VS Code 是否有针对 Apache Groovy 的语言扩展?

emacs - 如何禁用括号中的Emacs高亮空白?

html - 当 CSS 缩进不适用于所有浏览器时,我该如何解决?

javascript - 如何使用 swup.js 进行链接页面转换

json - 如何调试 "main"以外的其他项目?