Customize Search Exclusions in VS Code | Generated by AI

Home 2025.08

In VS Code, the global file search respects the search exclusions you configure. You can tell it to ignore certain files or folders so they don’t appear in search results.

Here are the main ways:


1. Use search.exclude in settings.json

Open your settings (⌘, / Ctrl+, → top right “Open Settings (JSON)”) and add:

"search.exclude": {
  "**/node_modules": true,
  "**/dist": true,
  "**/*.log": true
}

2. Use .gitignore

If your project has a .gitignore, you can tell VS Code to respect it during search:

"search.useIgnoreFiles": true

That way, anything ignored by Git won’t show in search results.


3. Use .ignore

You can also create a .ignore file in your project root (same format as .gitignore) specifically for editor tooling. VS Code will respect it if search.useIgnoreFiles is enabled.


4. Quick Exclude in Search UI

When you search, hover over a file/folder in the results and click “Exclude”. This temporarily adds that path to search.exclude in settings.


👉 So the most common setup is:


Do you want me to show you how to exclude only during search but still keep those files in Explorer, or also hide them from the Explorer side panel?


Back Donate