Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 887
Patillac Avatar asked Oct 21 '25 20:10

Patillac


1 Answers

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
}
like image 137
Benjamin Pasero Avatar answered Oct 23 '25 16:10

Benjamin Pasero



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!