How to change indentation in Visual Studio Code?

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

    Problem: The accepted answer does not actually fix the indentation in the current document.

    Solution: Run Format Document to re-process the document according to current (new) settings.

    Problem: The HTML docs in my projects are of type "Django HTML" not "HTML" and there is no formatter available.

    Solution: Switch them to syntax "HTML", format them, then switch back to "Django HTML."

    Problem: The HTML formatter doesn't know how to handle Django template tags and undoes much of my carefully applied nesting.

    Solution: Install the Indent 4-2 extension, which performs indentation strictly, without regard to the current language syntax (which is what I want in this case).

提交回复
热议问题