While changing the default behavior for Visual Studio Code requires an extension, you may override the default behavior in the workspace or user level. It works for most of the supported languages (I can guarantee HTML, JavaScript, and C#).
Workspace level
Benefits
- Does not require an extension
- Can be shared among teams
Outcomes
.vscode/settings.json
is created in the project root folder
How To?
Go to: Menu File → Preferences → Workspace Settings
Add and save "editor.formatOnType": true
to settings.json (which overrides default behavior for the project you work on by creating .vscode/settings.json file).
User environment level
Benefits
- Does not requires extension
- Personal development environment tweeking to rule them all (settings:))
Outcomes
- User's
settings.json
is modified (see location by operating system below)
How To?
Go to: menu File → Preferences → User Settings
Add or change the value of "editor.formatOnType": false
to "editor.formatOnType": true
in the user settings.json
Your Visual Studio Code user's settings.json
location is:
Settings file locations depending on your platform, the user settings file is located here:
- Windows:
%APPDATA%\Code\User\settings.json
- Mac:
$HOME/Library/Application Support/Code/User/settings.json
- Linux:
$HOME/.config/Code/User/settings.json
The workspace setting file is located under the .vscode folder in your project.
More details may be found here.