skip to Main Content

I’m not fond of the indentation guides in VS Code and find them distracting, except in HTML where they are necessary.

I know that I can disable them for all files by adding "editor.guides.indentation": false to settings.json, but is there any way of disabling them for all files but HTML files?

2

Answers


  1. To change the indentation based on programming language:

    Open the Command Palette (CtrlShiftP | macOS: ⇧⌘P).
    Type and select: Preferences: Configure Language Specific Settings… (command id: workbench.action.configureLanguageBasedSettings).
    Select a programming language (for example TypeScript).
    If Settings menu is opened (since 1.66.0):
    4. Press → to place the cursor right beside the language filter (e.g. @lang:typescript).
    5. Type Tab Size and enter your preferred value in the text box.

    If settings.json file is opened:
    4. Add this code:

    "[typescript]": {
        "editor.tabSize": 2
    }
    

    See also: VS Code Docs

    Reference => https://stackoverflow.com/a/45671704/12828696

    Login or Signup to reply.
  2. In settings.json:

    "editor.guides.indentation": false,
    "[html]": { // for multiple languages, ex. "[html,css,javascript]"
        "editor.guides.indentation": true,
    },
    

    See also https://code.visualstudio.com/docs/getstarted/settings#_language-specific-editor-settings.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search