Patillac
Patillac

Reputation: 313

How to change tabSize and insertSpaces in vscode

How do you actually go about changing the "editor.tabSize" and "editor.insertSpaces" values for vscode? I've opened File > Preferences > User Settings and added:

    // 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,
}

However, when I open an html file with two-space tabs, pressing tab inserts two spaces, and when I open a file that uses \t tabs, pressing tab inserts \t.

What am I doing wrong that causes vscode to not respect my settings?

Upvotes: 4

Views: 15192

Answers (1)

Benjamin Pasero
Benjamin Pasero

Reputation: 123716

There is a trailing comma in your snippet and currently VSCode fails to understand settings with malformed JSON. I am happy to say that with the next update, this issue should be fixed :)!

The working version of settings is:

    // 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
}

Upvotes: 12

Related Questions