What is a VS Code Multi-Root Workspace?

Visual Studio Code’s multi-root workspace feature allows developers to work with multiple, independent project folders within a single VS Code window. This article explains what multi-root workspaces are, how they benefit your development workflow, how to configure them, and how they differ from standard single-folder setups.

Understanding Multi-Root Workspaces

By default, Visual Studio Code operates in a single-folder mode, where you open one directory and work on the files within it. However, modern development often involves working on multiple related projects simultaneously—such as a frontend React application, a backend Node.js API, and a shared documentation folder.

A multi-root workspace solves this by allowing you to add separate, unrelated folders from different locations on your hard drive into a single Explorer view. Even though these folders reside in different directories, VS Code treats them as a unified project workspace.

Key Benefits of Multi-Root Workspaces

How to Create a Multi-Root Workspace

Setting up a multi-root workspace is straightforward:

  1. Open your first project folder in VS Code using File > Open Folder.
  2. Add additional folders by selecting File > Add Folder to Workspace… from the top menu.
  3. Save this configuration by selecting File > Save Workspace As…. This will prompt you to save a .code-workspace file.

The .code-workspace file is a JSON file that stores the absolute or relative paths of the included folders, along with any custom workspace-specific settings or launch configurations. Whenever you want to return to this multi-folder environment, simply double-click or open this .code-workspace file in VS Code.