From the File Menu navigate to Preferences and then to Settings. Search for and set the following settings.
Auto-save files 250ms after you switch tabs or leave the editor:
Remove all whitespace at the end of lines and format using Prettier on save:
For certain setting you will need to edit the VS Code settings.json file.
For example, it’s very common to use only two spaces for Javascript indentation. Let’s configure this manually.
From the Settings page click on the “Open Settings (JSON)” button at the top right. The icon is a document with an arrow.
Add the following key/value pair within the JSON object:
"[javascript]": {
"editor.tabSize": 2
},