Last updated: Apr 6, 2024
Reading time·6 min
If you need to close your currently opened project folder:
Alt
to show the top menu on Windows and
Linux.Here is a short clip that demonstrates the process.
There is also a keyboard shortcut that you can use to close the current project folder:
Ctrl + K
then press F
.Cmd + K
then press F
.You first press Ctrl + K
, release the keys and then press F
.
You can view the keyboard shortcut for your operating system in this section of the docs.
Key
column to view the value for other operating systems.If you need to open a folder:
Alt
to show the top menu on Windows and
Linux.There is also a keyboard shortcut for the Open Folder command:
Ctrl + K
, release the keys and then press
Ctrl + O
.Cmd + K
, release the keys and then press Cmd + O
.The Close Folder command closes your currently opened project folder.
If you need to remove a folder from a workspace:
Alt
to show the top menu on Windows and Linux.Here is a short clip that demonstrates the process.
You can also remove a folder from a workspace by using the Command Palette.
Ctrl
+ Shift
+ P
on Windows and Linux.Command
+ Shift
+ P
on macOS.F1
to open the Command Palette.Note that there is no option to add a subdirectory to a workspace.
You have to first remove the folder from the workspace and then add the subdirectories after.
Here is a short clip that demonstrates the process.
If you need to open the new folders in a new Window:
Alt
to show the top menu on Windows and Linux.You can also use the keyboard shortcut:
Ctrl
+ Shift
+ N
Cmd
+ Shift
+ N
In the new Window, select File in the top menu and then click Open Folder.
Select the folder you want to add to the Window.
However, when you open the folder in a new window, you aren't able to search through all folders in the multiple Windows at once.
If you need to open multiple folders in the existing VS Code Window:
Alt
to show the top menu on Windows and Linux.The folders will appear side by side in Explorer.
You can right-click on any of the folders in Explorer and select:
Each folder in your workspace may contain folder-specific settings in
.vscode/settings.json
.
If you need to open the settings for a specific folder:
The settings UI opens with the specified folder selected.
Any configuration only applies to the currently selected folder and overrides any global configuration.
If the User tab is selected, then settings are applied globally (to all folders in the workspace).
You can also use drag and drop to open multiple folders.
If you drag and drop one or more folders to the Explorer region of your editor, they get added to the workspace.
When you first create your workspace, it will be marked as UNTITLED (WORKSPACE).
If you want to save your workspace configuration and your workspace a name, you have to save it.
Otherwise, the workspace won't persist once you close the VS Code instance.
If you attempt to close an untitled workspace, you will get prompted whether you want to save it.
If you plan to open your workspace again, you should save it.
You can also save your workspace by using the top menu.
Alt
to show the top menu on Windows and Linux.The file will have a .code-workspace
extension.
The file stores your workspace configuration, so it can be used to open it.
You can open your workspace from a file in multiple ways:
.code-workspace
extension (assuming VS Code
is your default application for opening such files)..code-workspace
file.I've also written an article on how to rename a file, folder or workspace in VS Code.
You can learn more about the related topics by checking out the following tutorials: