visual-studio-codecode-formatting

How do you format code on save in VS Code


I would like to automatically format TypeScript code using the build-in formatter when I save a file in Visual Studio Code.

I'm aware of the following options, but none of them is good enough:


Solution

  • As of September 2016 (VSCode 1.6), this is now officially supported.

    Add the following to your settings.json file:

    "editor.formatOnSave": true
    

    Here is the menu to access the settings enter image description here