Knowing how to close a VS Code project can make it easier to switch between tasks, keep your workspace organized, and avoid accidentally closing the wrong window. In Visual Studio Code, a “project” is usually a folder or a saved workspace, so closing a project is different from closing an individual file or shutting down the entire application.
This guide explains how to close a folder or workspace in VS Code, close a window, and reopen a project later. It also covers unsaved files, keyboard shortcuts, and common problems. The steps apply to VS Code on Windows, macOS, and Linux, with shortcut differences noted where they matter.
What Does “Close a Project” Mean in VS Code?
VS Code does not use a single Close Project command in every situation. What you should close depends on how you opened your work:
- A folder: A directory opened with Open Folder is the root of your current VS Code project.
- A workspace: A saved workspace can contain one or more folders, along with workspace-specific settings.
- An editor tab: A tab is an individual file. Closing it does not close the project folder or workspace.
- A window: A VS Code window contains the folder or workspace you are currently working in. Closing the window exits that project view but may leave the application running.
In everyday use, “close the project” usually means closing the folder or workspace while keeping VS Code available. If you want to stop working in the current window entirely, close the window instead.
How to Close a Folder in VS Code
If you opened a project folder directly, use the Close Folder command to remove it from the current window. This does not delete your project files or uninstall anything. It simply closes the folder view in VS Code.
- Save any files you want to keep.
- Open the File menu.
- Select Close Folder.
VS Code closes the folder and usually displays an empty window or its welcome screen. The exact view can depend on your settings and version. Your source code remains in its original location on your computer, and you can open the folder again whenever you need it.
You can also use the default keyboard shortcut on supported Windows and Linux installations: Ctrl+K, followed by F. On macOS, the corresponding shortcut is generally Cmd+K, followed by F. Press the keys in sequence rather than holding them all down together. Shortcuts can be changed or affected by extensions, so the File menu is a reliable alternative.
How to Close a VS Code Workspace
A VS Code workspace is a saved arrangement of folders and settings. If your current window has a workspace open, look in the File menu for the option to close it. Depending on the way the workspace was opened, the command may appear as Close Workspace or as another close option for the current folder or window.
- Save any unsaved changes in your open files.
- Select File in the menu bar.
- Choose the available command for closing the workspace or its window.
Closing a workspace does not remove the workspace file or the folders it references. A workspace file, commonly saved with the .code-workspace extension, stores information about the workspace setup. You can open that file later to restore the workspace.
If you have a multi-root workspace, closing it ends the current view of all folders included in that workspace. It does not close or delete those folders individually from your computer. If you only want to remove one folder while keeping the rest of the workspace open, use the Explorer’s workspace-folder controls instead of closing the entire workspace.
How to Close a VS Code Window
Close the window when you are finished with the current project view, or when you want to leave one VS Code window open for a different task. Use the window’s close button or choose File > Close Window, if that command is available in your menu.
- Windows and Linux: The common shortcut is Ctrl+Shift+W.
- macOS: The common shortcut is Cmd+Shift+W.
Closing a window is not always the same as quitting VS Code. If other VS Code windows are open, they can remain on screen. On macOS, the application may also stay active after its last window closes. To exit the application, use the operating system’s quit command or the appropriate VS Code menu option.
Before closing a window, check whether VS Code prompts you to save changes. Choose to save if you want to keep your edits, or discard them only if you are certain you do not need them.
Close a Project Without Closing an Editor Tab
It is easy to mix up closing a file and closing a project. Clicking the X on a tab, or using the Close Editor shortcut, closes only that file’s editor tab. The project folder and VS Code window remain open.
For example, if you have several files open and close one tab, the other tabs and the Explorer folder tree stay available. To close the entire project folder, use File > Close Folder. To close the current project window, use Close Window instead.
This distinction is useful when tidying your editor. Close tabs when you want fewer files visible; close the folder or workspace when you are switching to a different project.
Save Your Work Before Closing a Project
VS Code may show a dot or other indicator on a file tab when that file has unsaved changes. Save those changes before closing the folder or window if you want to keep them. Use File > Save for the current file, or File > Save All to save all open files that have changes.
You can also use the standard save shortcuts:
- Windows and Linux: Ctrl+S to save the active file; Ctrl+K, then S to save all.
- macOS: Cmd+S to save the active file; Cmd+Option+S is commonly used to save all.
Shortcut availability can vary with your keybindings. If you are unsure, check the File menu or open the Keyboard Shortcuts editor and search for “Save All.” If VS Code asks whether to save a file as you close a project, review the prompt carefully before choosing an option.
How to Reopen a Closed VS Code Project
Closing a project does not remove it from your computer. To return to it, open its folder or workspace again:
- Select File > Open Folder to reopen a project folder.
- Browse to the folder you want and confirm your selection.
- To reopen a saved workspace, select File > Open Workspace from File, then choose the relevant
.code-workspacefile.
You can also use VS Code’s recent items list. Select File > Open Recent and choose a previously opened folder or workspace. The names shown in the list depend on your recent history and settings.
If VS Code opens the folder in a new window rather than the current one, that behavior may be controlled by your preferences or by the way you open it. You can manage window behavior in Settings by searching for options related to opening folders or new windows.
Close One Folder in a Multi-Root Workspace
A multi-root workspace contains multiple folders in one VS Code window. You may want to remove one folder from the workspace without closing the others. In the Explorer, locate the folder you want to remove, open its context menu, and select the option to remove that folder from the workspace.
This action changes the current workspace view; it does not delete the folder or its files. If you want the same set of folders to be available next time, save the workspace after making changes. If you want to exit the entire workspace, use the relevant close command from the File menu instead.
Common Problems When Closing a VS Code Project
- “Close Folder” is missing: You may be using a saved workspace, an empty window, or a different VS Code version. Check the File menu for a workspace or window closing command.
- The project appears to stay open: You may have closed an editor tab rather than the folder. Use File > Close Folder to close the folder view.
- VS Code opens another window: This is usually a window-management preference, not a sign that the project failed to close. Check your VS Code window settings.
- Changes seem to disappear: Check for unsaved files or a save prompt. If you discarded edits, those changes may not be recoverable unless another backup or version-control copy exists.
- A terminal or task is still running: Closing a folder may not stop every process launched outside the editor. Check the integrated terminal and stop any process you no longer need.
Frequently Asked Questions
Does closing a VS Code project delete its files? No. Closing a folder or workspace only changes what is open in VS Code. It does not erase the project from your drive.
Can I close a project and keep VS Code open? Yes. Use File > Close Folder or the appropriate workspace command. VS Code can remain open with an empty window or welcome screen.
How do I close VS Code completely? Close the open windows and then use your operating system’s quit command if the application remains active. Save any work you want to keep first.
What is the difference between Close Folder and Close Window? Close Folder removes the current folder from the VS Code window. Close Window closes that window, including its current project view. Neither command deletes your project files.
Conclusion
To close a VS Code project, first identify whether you opened a folder, a saved workspace, or simply an editor tab. Use File > Close Folder to close a folder while keeping VS Code available, close the workspace when you are finished with a saved workspace, or close the window to end that project view. Save your changes before leaving, and reopen your work later through Open Folder, Open Workspace from File, or Open Recent. Once you know the difference between these options, switching projects in VS Code is straightforward and safe.
Disclaimer: Articles are written by Humans, AI or Both. Verify Important information.