Visual Studio Code Code.autoSave onFocusChange not working

I am trying to configure a visual code editor to automatically save files when changing focus.

Reading the setup documentation, I installed the settings.json file for the project as follows:

// Place your settings in this file to overwrite default and user settings. { "files.exclude": { "**/*.js": { "when": "$(basename).ts"}, "files.autoSave": "onFocusChange" } } 

But when I make changes to the file and then switch to another file, nothing happens (I still need to save the file manually).

What am I doing wrong?

+6
source share
1 answer

The "files.autoSave" parameter must be outside the "files.exclude" section.

  "files.exclude": { "**/*.js": { "when": "$(basename).ts"} }, "files.autoSave": "onFocusChange" 
+14
source

All Articles