Skip to content

VS Code Workspace Excludes

This document shows how to use a project-level VS Code settings file to hide generated folders such as pycache, .next, and node_modules from the Explorer sidebar and normal search results.

Create a .vscode directory inside the project root. VS Code reads settings.json from this folder automatically when the project is opened.

Terminal window
mkdir -p .vscode
nano .vscode/settings.json

Use files.exclude to hide folders from the Explorer sidebar. Use search.exclude to remove them from normal VS Code search results.

{
"files.exclude": {
"**/__pycache__": true,
"**/.next": true,
"**/node_modules": true
},
"search.exclude": {
"**/__pycache__": true,
"**/.next": true,
"**/node_modules": true
}
}

VS Code applies the workspace settings automatically. If the window is already open, reload it once after saving the file.

Terminal window
code .

If VS Code is already open, use the command palette and run Developer: Reload Window.

The .vscode/settings.json file must be inside the same project root that is opened in VS Code.

Terminal window
my-project/
.vscode/
settings.json
backend/
frontend/
node_modules/
.next/
Setting Purpose
files.exclude Hides matching files and folders from the Explorer sidebar.
search.exclude Prevents matching files and folders from appearing in normal search results.
**/pycache Matches Python bytecode cache folders at any depth.
**/.next Matches Next.js build output folders at any depth.
**/node_modules Matches Node.js dependency folders at any depth.

These settings are project-specific when stored under .vscode/settings.json.

Copy the same .vscode/settings.json file into other projects when the same behavior is needed.

If settings.json already exists, merge the files.exclude and search.exclude blocks into the existing JSON instead of replacing the whole file.