How to change indentation in Visual Studio Code?

前端 未结 14 1656
臣服心动
臣服心动 2020-12-02 03:47

For every typescript file visual studio code uses an auto indentation of 8 spaces. This is a bit too much for my taste but I can\'t find where to change it.

Maybe it

14条回答
  •  爱一瞬间的悲伤
    2020-12-02 04:47

    To set all existing files and new files to space identation to 2 just put it in your settingns.json (in the root of json):

    "[typescript]": {
            "editor.defaultFormatter": "vscode.typescript-language-features",
            "editor.tabSize": 2,
            "editor.insertSpaces": true,
            "editor.detectIndentation":false
     }
    

    you can add the language type of the configuration:

    "[javascript]": {
        "editor.tabSize": 2,
        "editor.insertSpaces": true,
        "editor.detectIndentation":false
    } 
    

提交回复
热议问题