How to change indentation in Visual Studio Code?

前端 未结 14 1672
臣服心动
臣服心动 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:35

    How to turn 4 spaces indents in all files in VS Code to 2 spaces

    • Open file search
    • Turn on Regular Expressions
    • Enter: ( {2})(?: {2})(\b|(?!=[,'";\.:\*\\\/\{\}\[\]\(\)])) in the search field
    • Enter: $1 in the replace field

    How to turn 2 spaces indents in all files in VS Code to 4 spaces

    • Open file search
    • Turn on Regular Expressions
    • Enter: ( {2})(\b|(?!=[,'";\.:\\*\\\/{\}\[\]\(\)])) in the search field
    • Enter: $1$1 in the replace field

    NOTE: You must turn on PERL Regex first. This is How:

    • Open settings and go to the JSON file
    • add the following to the JSON file "search.usePCRE2": true

    Hope someone sees this.

提交回复
热议问题