'VScode Folder automatically closes when vscode get closed

Before:

vscode after opening the folder

After:

folder closed automatically

When i am doing quit(cmd+Q) and reopening it, it loads the previous folder which i am working at, but if i press the top left red button and reopen everything is gone, i have to reopen the folder.



Solution 1:[1]

You can choose the corresponding settings in Window: Restore Window. Default is all

setting

If you prefer the settings.json

"window.restoreWindows": "all"

Copied from vscode document:

Controls how windows are being reopened after starting for the first time. This setting has no effect when the application is already running.

  • preserve: Always reopen all windows. If a folder or workspace is opened (e.g. from the command line) it opens as a new window unless it was opened before. If files are opened they will open in one of the restored windows.
  • all: Reopen all windows unless a folder, workspace or file is opened (e.g. from the command line).
  • folders: Reopen all windows that had folders or workspaces opened unless a folder, workspace or file is opened (e.g. from the command line).
  • one: Reopen the last active window unless a folder, workspace or file is opened (e.g. from the command line).
  • none: Never reopen a window. Unless a folder or workspace is opened (e.g. from the command line), an empty window will appear.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hunter Tran