VS Code Confirm Before Quit

The desktop version of VS Code has a new feature that pops a confirmation dialog before quitting the app.

This feature however has been available for VS Code for Web for some time, so it’s not entirely new.

Let’s go ahead and turn on this feature!

 

Press down CTRL + SHIFT + P and type in open settings and open the settings.json file.

The setting is called window.confirmBeforeClose and can have 2 noticeable options:

  1. keyboardOnly
  2. always

The keyboardOnly option brings up the confirmation dialog when a keybind is used (i.e ALT+F4).

The always option brings up the confirmation dialog whenever you’re trying to quit the app, be it by keybinding or by using the mouse.


So, your code should look like this:

"window.confirmBeforeClose": "keyboardOnly"

or

"window.confirmBeforeClose": "always"


That’s all!

I hope you found this article helpful.

 

Let me know what you think about this article through comments below, or on Twitter at @pelu_carol.

If you find this article helpful, please share it with others and subscribe to the blog to support me, and receive a bi-monthly-ish e-mail notification on my latest articles.

 

You may also like...