Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code - Save file before build

Is it possible to automatically save all changed files before build? It's a bit tedious to press Ctrl+s and then Ctrl+Shift+b all the time.

like image 636
Amomum Avatar asked Apr 26 '17 20:04

Amomum


1 Answers

If you don't need to build but rather run the file, then you can adjust the Code Runner extension settings by adjusting your user settings. Settings can be accessed in file > preferences > settings (or with Ctrl+comma.)

To save the current file before running add the line below to your User Settings:

"code-runner.saveFileBeforeRun": true,

or to save all files before running, add this line:

"code-runner.saveAllFilesBeforeRun": true,

I also added this shortcut key(keybinding) to file > preferences > keyboard shortcuts > keybindings.json

{
    "key": "ctrl+enter",
    "command": "code-runner.run"
},

Now I can just hit Ctrl+Enter and all the magic happens.

like image 99
leerssej Avatar answered Sep 28 '22 06:09

leerssej