Qais "qaisjp" Patankar

Close all VS Code editors without saving

19 Mar 2024

I got myself into a pickle where I had 1000 edited files open, and choosing “Close All” would prompt for “Save or discard changes” 1000 times. I’m not clicking “Don’t save” that many times. 😬

Here’s how I closed all of the Visual Studio Code editor windows without saving them:

  1. Add "files.hotExit": "off", to User Settings JSON. It tells VS Code to forget about unsaved files when you close VS Code.
  2. Cmd-Shift-P, type “Reload window”, and hit enter.
  3. Click “Don’t save”
  4. ???
  5. PROFIT!

Don’t forget to undo your User Settings JSON change.

(Save all followed by git reset wasn’t an option because it would run all auto-formatters. Even after turning off the auto-formatters, VS Code would lock up trying to save that many files.)

Contributors: yungchar, matv, jjiang