Skip to content
SunnyWriteUps
Go back

Supercharge Your Workflow The Complete Guide to VS Code Workspaces

Edit page

VS Code Workspaces solve this by grouping multiple distinct folders into a unified environment with shared tasks, isolated extensions, and dedicated settings.


Single Folder vs. Multi-Root Workspaces


Setting Up Your First Multi-Root Workspace

  1. Open Your Initial Project Directory: Launch VS Code and open your primary root folder via File > Open Folder… (e.g., api-backend).

  2. Add Additional Folders to the Workspace: Navigate to File > Add Folder to Workspace… and select your secondary directories (such as web-frontend or shared-types). They will now appear side-by-side in your File Explorer.

  3. Save the Workspace Configuration File: Go to File > Save Workspace As… and save the file (e.g., project.code-workspace) in your project root.


Inside the .code-workspace File

Under the hood, your workspace file is simple JSON. It controls three essential pillars: folders, global/folder settings, and extension recommendations.

{
  "folders": [
    {
      "name": "Backend Service",
      "path": "services/backend"
    },
    {
      "name": "Web Client",
      "path": "apps/frontend"
    }
  ],
  "settings": {
    "editor.tabSize": 2,
    "files.exclude": {
      "**/.git": true,
      "**/node_modules": true
    },
    "[python]": {
      "editor.formatOnSave": true
    }
  },
  "extensions": {
    "recommendations": [
      "esbenp.prettier-vscode",
      "ms-python.python",
      "dbaeumer.vscode-eslint"
    ]
  }
}

How Workspaces Improve Development

1. Unified Search and Git Tracking

Search across every repository in your workspace with Ctrl+Shift+F (or Cmd+Shift+F). The Source Control panel automatically segments changes per repository, letting you stage and commit backend and frontend updates in parallel without switching windows.

2. Scope-Specific Tooling & Linters

Prevent configuration bleed. You can set Python/Ruff settings specifically for your backend while enforcing ESLint and Prettier strictly inside your frontend directory:

{
  "settings": {
    "services/backend": {
      "python.defaultInterpreterPath": "./venv/bin/python"
    }
  }
}

Add required linters, formatters, and Docker tools directly to the "extensions.recommendations" block. When a teammate opens project.code-workspace, VS Code prompts them with a one-click install for the entire toolchain.

4. Cross-Project Task Automation

Define composite tasks in .vscode/tasks.json that start your entire stack—spinning up a Node server and a Python worker concurrently with a single shortcut (Ctrl+Shift+B / Cmd+Shift+B).


Best Practices


Edit page
Share this post on:

Previous Post
Agent loop to handle Angular upgrades on a 3–6 month
Next Post
how to create your rust package