How to set per-filetype tab size in VS Code?

VS Code configures language specific settings in settings.json

  • Shortcut is: Command Palette (⇧⌘P) then: Preferences: Configure Language Specific Settings

Example of setting.json changing tabsize

{
    // this is the default for all languages, unless otherwise specified.
    "editor.tabSize": 4,
    "[sass]": {
        "editor.tabSize": 2
    },
    "[html]": {
        "editor.tabSize": 4
    },
    "[javascript]": {
        "editor.tabSize": 2
    }
}

These are not nested inside any other object, they are defined at the root.

Leave a Comment