Consolidate Related Projects with VS Code Multi-Root Workspaces
Open multiple project folders in one VS Code window with a .code-workspace file, then search, debug, and run terminals across roots without switching windows.
02 Jul 2026, 22:13 UTC

You finish a frontend edit, switch to the API window to restart the server, then flip back to adjust a shared type. Each window keeps its own search index, terminal, and open editors. The context switching wastes time and makes cross-repository references easy to miss.
Takeaway: VS Code multi-root workspaces let you open multiple folders in one window using a .code-workspace file. You get a single Explorer, one global search, and shared terminals while each project keeps its own IntelliSense, git history, and folder-specific settings.
What a multi-root workspace is
A workspace is the collection of folders and settings VS Code manages in a window. A multi-root workspace lists several folders in one .code-workspace JSON file. Each folder remains a separate root: it has its own node_modules, git repository, and language server. Extensions activate per root, so frontend IntelliSense does not leak into backend code.
Create and share a workspace file
Open the folders you want to group, then use the File menu to save the workspace as a .code-workspace file, typically in a shared location such as the repository root. The file looks like this:
{
"folders": [
{ "path": "frontend" },
{ "path": "backend" }
],
"settings": {
"editor.formatOnSave": true
}
}Paths are relative to the workspace file location. Relative paths let teammates clone the same repository and open the workspace without editing absolute directories. If you must use absolute paths, the file will break on other machines or operating systems.
Where to run: File menu, Save Workspace As in VS Code desktop. Permissions: none beyond normal file write access. Expected check: reopen the .code-workspace file and confirm the Explorer sidebar shows both folder roots. Risk: committing absolute paths can confuse teammates on different operating systems.
Folder-specific settings and terminals
You can scope settings to individual roots so a formatter applies to the frontend while the backend uses a different one:
{
"folders": [
{ "path": "frontend", "settings": { "editor.defaultFormatter": "esbenp.prettier-vscode" } },
{ "path": "backend", "settings": { "editor.defaultFormatter": "ms-python.black-formatter" } }
]
}Workspace settings follow user, then workspace, then folder precedence. A folder setting overrides the user setting only inside that root.
Integrated terminals can start in a chosen root. Use the terminal dropdown or command palette to create a terminal in the active folder, then run commands such as npm install or cargo build without changing directories manually.
Verification steps
- Open the
.code-workspacefile. The Explorer should list both roots. - Press Ctrl+Shift+F (Cmd+Shift+F on macOS). Search results should appear under both folder headings.
- Open an integrated terminal in each root and run
pwdon Linux or macOS, orcdon Windows. The printed path should match that root. - Open the Output panel, select Extension Host, and confirm language servers start separately for each root.
Limitations to watch
Multi-root workspaces are not free. Opening many large folders increases memory use and file watcher load, which can slow global search compared with a single-folder window. Some extensions assume one project root and may duplicate work or behave unexpectedly. Workspace-level settings can silently override your user preferences, so check Settings > Workspace if behavior changes after opening a workspace.
Rollback: If the workspace causes problems, close the workspace and reopen the folders individually, or delete the .code-workspace file. No project data is modified by the workspace file itself.
Start with two related folders, save a .code-workspace file with relative paths, commit it, and run a global search across both roots. If search and terminals feel unified without slowing the machine, the workspace is worth keeping.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.