Skip to main content
This is a quick tip on how to format (prettify) the code every time you save a file in Visual Studio Code. The first step is to go to Settings, this can be achieve by clicking on Code -> Preferences -> Settings Visual Studio Code - Settings Then you’ll view your settings file, it should look like the following: Visual Studio Code - User Settings The settings are in a JSON format so, in your right panel you can add the following line to enable automatic Format on Save:
"editor.formatOnSave": true
And your settings should look something like this Visual Studio Code - User Settings - Auto Format And that’s it, now your HTM, JavaScript and every other language that you had a formatter for, will re-indent nicely on every save.

Bonus

You can search for any setting and see its default settings on the left-hand side. If you want to change it, just copy it in the object on the right-hand side, change the value, save, and you’re done.
Sebastián Becerra

Sebastián Becerra

Trabajo con tecnologías web en arquitecturas Cloud. Me gusta descubrir y aprender nuevas tecnologías en Layouts (CSS, Sass, Less), Frameworks de Desarrollo (JQuery, AngularJS, Ionic) y plataformas Web (Wordpress, Joomla, Prestashop). He colaborado con diferentes proyectos de software libre y código abierto con fines sociales. Además participé en distintos eventos TI exponiendo sobre comunidades y educando sobre tecnologías Web.

Leave a Reply