如何在 vscode 中更改 tabSize 和 insertSpaces

How to change tabSize and insertSpaces in vscode

您实际上是如何更改 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,
}

但是,当我打开一个带有两个 space 标签的 html 文件时,按标签会插入两个 space,而当我打开一个使用 \t 标签的文件时,按制表符插入 \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
}