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 the workspace settings file
Create a .vscode directory inside the project root. VS Code reads settings.json from this folder automatically when the project is opened.
mkdir -p .vscode
nano .vscode/settings.jsonAdd Explorer and search excludes
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
}
}Apply the settings
VS Code applies the workspace settings automatically. If the window is already open, reload it once after saving the file.
code .If VS Code is already open, use the command palette and run Developer: Reload Window.
Confirm the project layout
The .vscode/settings.json file must be inside the same project root that is opened in VS Code.
my-project/
.vscode/
settings.json
backend/
frontend/
node_modules/
.next/What each rule does
| 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. |
Notes
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.