Max Kreutzfeldt

September 24, 2023

Organize code projects with VS Code Workpsaces

To open a code project in VS Code you just have to use File/Open folder… or to drag and drop the project folder on the VS Code app icon. This is all enough for projects with a single root folder. For other project types VS Code offers an advanced way of project organisation called “Workspaces”.

Workspaces group multiple project folders, which can exist at any path. That makes it easy to access them in the VS Code Editor. Workspaces are an native VS Code feature. They can be be helpful, when you work with multiple git repositories related to a project.

Create a workspace

  1. Open a project folder, that should be part of the workspace.
  2. Go to File/Save Workspace as….
  3. You will be asked to store a .code-workspace file. Define a name for it and save it where you like to.
  4. Open the VS Code explorer. You should now see an accordion named like the .code-workspace file suffixed by “(Workspace)”. The accordion lists all project folders of the workspace.

Add folder to workspace

  1. Open your workspace with the created .code-workspace file.
  2. Go to File/Add folder to Workspace.
  3. Select and add the folder you want to place in the workspace.
  4. The selected folder will appear in the workspace accordion, that you can reach with the Explorer in VS Code.

That's it. Other ways to organize code projects can applied through extensions from the VS Code extension store.