Workspace Folder Toggle
Turn folders of a multi-root VS Code workspace on or off with a checkbox. No more hand-editing your .code-workspace file.
Big workspaces with many repos get slow and noisy. This extension lets you keep every folder listed in the workspace file and switch on only the ones you need right now.
How it works
Your .code-workspace file has a "folders" list. When you untick a folder, the extension comments out that folder's line with //. When you tick it again, it removes the //. Nothing is deleted. Disabled folders stay in the file, so you can bring them back at any time.
Before:
"folders": [
{ "name": "app", "path": "." },
{ "name": "api", "path": "../api" },
{ "name": "docs", "path": "../docs" }
]
After unticking docs:
"folders": [
{ "name": "app", "path": "." },
{ "name": "api", "path": "../api" },
// { "name": "docs", "path": "../docs" }
]
VS Code reads the file, sees the change, and removes the folder from the Explorer. Tick it again and it comes back.
Features
- Sidebar view. A Workspace Folders icon in the Activity Bar lists every folder with a checkbox.
- Saves instantly. Each click writes to the
.code-workspace file right away.
- Enable All / Disable All. Buttons at the top of the view.
- Refresh. Button at the top of the view. The view also refreshes by itself when you edit the workspace file by hand.
- Groups. Folders in a block separated by blank lines show as a group with its own checkbox. Tick the group to switch all its folders at once. A comment line like
// # Backend above a block names the group.
- Locked folders. The first folder in the list (the workspace root) is always on and cannot be unticked. The folder
../others is also always on and shows a lock icon.
- Manager panel. Run Workspace Folder Toggle: Open Manager from the Command Palette for a full-page list with Select All, Unselect All and Save.
Usage
- Open a saved
.code-workspace file (File > Open Workspace from File).
- Click the Workspace Folders icon in the Activity Bar.
- Tick or untick folders. The Explorer updates.
The extension reads the "folders" list line by line, so keep each folder on one line:
{ "name": "api", "path": "../api" },
A folder written over several lines is not seen by the extension.
To make groups, put a blank line between blocks. To name a group, add a // # Name line at the start of the block:
"folders": [
{ "name": "app", "path": "." },
// # Backend
{ "name": "api", "path": "../api" },
{ "name": "worker", "path": "../worker" },
// # Frontend
{ "name": "web", "path": "../web" },
{ "name": "ui-kit", "path": "../ui-kit" }
]
Group (collapse) names
The text after // # is the name of the collapsible group in the sidebar. The sample above shows like this:
WORKSPACE FOLDERS
app (root, always on)
v [x] Backend <- group name, click arrow to collapse
[x] api
[x] worker
v [ ] Frontend <- group name
[ ] web
[ ] ui-kit
- Tick the group box to switch on or off all folders inside it.
- The group box is ticked only when every folder inside is ticked.
- A group with only one folder has no header. The folder shows alone.
- A group with no
// # Name line is named after its first folder.
Requirements
- VS Code 1.90 or newer.
- A saved multi-root workspace (a
.code-workspace file on disk). It does not work with a plain single folder, or with remote or virtual workspaces.
Good to know
- Because disabled folders are comments, the file must allow comments.
.code-workspace files do, so this is fine in VS Code.
- The extension edits your workspace file directly. Keep it in version control if it matters to you.
License
MIT