Save Multiple Folders as a Workspace in VS Code

Working with multiple related projects in Visual Studio Code is made seamless by using multi-root workspaces. This article provides a quick, step-by-step guide on how to combine multiple folders into a single workspace and save it for easy access in the future, allowing you to manage different codebases within a single VS Code window.

Step 1: Open the First Folder

  1. Launch Visual Studio Code.
  2. Click on File in the top menu bar (or use the shortcut Ctrl+K Ctrl+O on Windows/Linux, or Cmd+O on macOS).
  3. Select Open Folder… (or Open… on macOS) and choose the first folder you want to include in your workspace.

Step 2: Add Additional Folders

  1. With the first folder open, go back to the top menu and click on File.
  2. Select Add Folder to Workspace… from the dropdown menu.
  3. Browse to and select the next folder you want to add, then click Add.
  4. Repeat this process for as many folders as you need. You will see all selected folders grouped together in the Explorer sidebar.

Step 3: Save the Workspace Configuration

  1. Once all your folders are added, click on File in the top menu.
  2. Select Save Workspace As….
  3. Choose a directory where you want to store the workspace configuration file.
  4. Give your workspace a recognizable name and click Save.

VS Code will generate a file with the .code-workspace extension. This JSON file stores the paths to your folders and any workspace-specific settings you configure.

How to Open Your Saved Workspace

To reopen your multi-folder setup in the future, you can: * Double-click the saved .code-workspace file on your computer. * Open VS Code, go to File > Open Workspace from File…, and select your saved .code-workspace file. * Select it from your File > Open Recent list.