Skip to content

Instantly share code, notes, and snippets.

@DawnBreather
Created February 28, 2024 11:59
Show Gist options
  • Save DawnBreather/df67ae2776c88eb6daf19ba0555f8e77 to your computer and use it in GitHub Desktop.
Save DawnBreather/df67ae2776c88eb6daf19ba0555f8e77 to your computer and use it in GitHub Desktop.
wiki.vscode

VSCode Configuration for Handling Unsaved Changes and Window Management

To adjust VSCode’s behavior for unsaved changes and window management to avoid being prompted to save changes when closing windows, follow these configurations:

Auto Save Configuration

Enable auto save to automatically save changes, which helps in not being prompted when trying to close a window.

  1. Open the Command Palette with Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac).

  2. Type Preferences: Open Settings (UI) and select it.

  3. In the search bar, search for Auto Save.

  4. You can choose from options like onFocusChange, onWindowChange, or afterDelay. Select the one that best fits your workflow.

Hot Exit Configuration

VSCode’s hot exit feature remembers unsaved changes and reopens them the next time VSCode is started.

  1. In the Settings UI (accessed as above), search for Hot Exit.

  2. Ensure Hot Exit is set to onExitAndWindowClose or onExit.
    onExitAndWindowClose saves unsaved changes and restores them even if you close just one window, while onExit works when exiting VSCode entirely.

Confirm Before Close Adjustment

To reduce interruptions from the confirmation dialog when closing a window, adjust the following:

  1. Currently, there isn’t a direct setting to disable the save confirmation for each window close in the UI settings. The closest feature is utilizing the auto save and hot exit configurations.

Note

Configuring Auto Save and Hot Exit allows for a workflow where changes are either saved automatically or kept in a state where VSCode remembers them without explicitly writing to the disk. This mimics a cache-like behavior, reducing the need for save prompts on window close. Ensure you have a backup or version control system to manage changes effectively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment