Reputation: 5306
I'm a long time visual studio developer and am stating with VS Code.
I found the Format Code shortcut (Shift + Alt + F) but I want it to run automatically whenever I press ;
. Is there a configuration for that?
Upvotes: 33
Views: 72052
Reputation: 11
I was trying to find the answer to the semicolon format thing, because it was doing it on my old computer but not my new one. You just have to change editor.formatOnType = true
in your JSON config settings.
Upvotes: 1
Reputation: 13558
To open your user and workspace settings, use the following VS Code menu command:
On Windows/Linux - File > Preferences > Settings
On macOS - Code > Preferences > Settings
Add these options to the editable panel of your configuration settings:
"editor.formatOnPaste": true,
"editor.formatOnSave": true
Upvotes: 12
Reputation: 16876
You can choose one of the below options
"editor.formatOnType": false,
"editor.formatOnPaste": false,
"editor.formatOnSave": false
Or create a custom keyboard shortcut by editing editor.action.formatDocument
. But I AFAIK there is no option to execute the command whenever you press ;
. You can set a keyboard shortcut, but I guess you're not able to write ;
anymore then :D
Upvotes: 26