How do I disable Visual Studio Code auto save

Viewed 32339

Some months ago I observed that angular-cli or Visual Code is saving my files after short delay. Which causes recompiling a project and refreshing a page. It is useful but frustrating a bit to wait couple of seconds every single time for refresh. Even after just opening a file. So, the solution that just hit me is very simple. Go to Preferences/Settings, in Workspace Settings put

"files.autoSave": "off"

That's it! Now your project will be compiled ONLY after you hit save.

4 Answers

Go to File-> Preferences ->settings

choose your auto save option from commonly used settings enter image description here

As @Alex Varghese mentioned in his answer you can do it in the settings. One addition is even if you turn off the auto save option in your user settings, that will not over write the option you have under Workspace settings, so you have to do the changes there as well.

enter image description here

enter image description here

enter image description here

You can also do this changes by going to the settings.json which usually resides at C:\Users\user\AppData\Roaming\Code\User.

"files.autoSave": "off"

To edit your Workspace settings, you need to edit the settings.json file which resides at the .vscode folder of your solution.

"files.autoSave": "off"

Vscode version 1.34 onwards just got to file menu and click on "Auto Save" to enable or disable Autosave.

Instead of completely disable autosave I prefer just increase delay and save it, e.g. after 10 min. You have a full control when to save it manually, but if you forget, it will save it after the specified long period.

Files: Auto Save : Controls auto save of dirty files.
afterDelay

Files: Auto Save Delay : Controls the delay in ms after which a dirty file is saved automatically. Only applies when Files: Auto Save is set to afterDelay.
600000

See VS Code documentation

Related