Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Choose the VS Code exclusion setting based on what you want to change: files.exclude hides folders from Explorer, search.exclude filters text search, and files.watcherExclude stops watching selected paths. They are not interchangeable. For repository-specific rules you want to share with a team, put them in the workspace settings and scope the patterns to the workspace folders you actually use.

Which VS Code setting should you use?

Start with the symptom, not the folder size. A folder can be hidden from navigation, omitted from search, or excluded from file watching independently. Microsoft documents these settings for different features in its user and workspace settings, search guidance, and Linux setup guidance.

Setting What it changes Explorer visibility Search and indexing implications File watching
files.exclude Hides matching files or folders from Explorer Hidden Can affect search, grep, and semantic indexing Not its purpose
search.exclude Excludes matching paths from text search Remain visible Filters search results Not its purpose
files.watcherExclude Prevents VS Code from watching matching paths Not a visibility setting Not a text-search filter Excluded from watching

Hide generated or dependency folders

Use files.exclude when folders such as build output should not appear in Explorer. Be aware that hiding a path can also affect search, grep, and semantic indexing, so avoid broad rules that hide source developers still need to find. Microsoft’s workspace context documentation also describes how exclusions can influence what tools can use from a workspace.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep folders visible but remove them from text search

Use search.exclude when developers should still browse a folder but do not want its contents in routine text-search results. Search can take substantial time and CPU in folders containing many files; Microsoft’s Visual Studio Code FAQ notes that such a search can temporarily slow VS Code responsiveness.

Reduce file-watching activity

Use files.watcherExclude when the issue is file watching rather than Explorer clutter or search noise. On Linux, VS Code setup guidance discusses watcher exhaustion reported as ENOSPC and identifies watcher exclusions as one possible remedy. The guidance also discusses operating-system watch limits; the appropriate response depends on the machine and distribution, so there is no universal limit or setting value to apply.

Put monorepo rules in workspace settings

Workspace settings are stored in the workspace’s .vscode/settings.json and let a project keep repository-specific rules with its code. If the workspace has multiple root folders, first determine which roots are open and whether each rule should apply relative to every root. Settings patterns are evaluated relative to each workspace folder.

This combined example applies three different behaviors to dependency and build-output folders at any depth beneath each workspace root. Keep only the settings that match the intended outcome, and adapt folder names to the repository:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
{
  "files.exclude": {
    "**/node_modules": true,
    "**/dist": true
  },
  "search.exclude": {
    "**/node_modules": true,
    "**/dist": true
  },
  "files.watcherExclude": {
    "**/node_modules/**": true,
    "**/dist/**": true
  }
}

The three entries are separate choices: the first hides folders, the second filters search, and the third excludes paths from watching. Adding all three is appropriate only if all three behaviors are wanted.

How glob patterns match nested folders

VS Code settings use glob patterns. A slash separates path segments, * matches within one segment, ? matches one character, and ** matches any number of path segments. For example, **/dist matches a folder named dist at the workspace root or nested under packages. The exact matching rules are in Microsoft’s Glob Patterns Reference.

  • Use **/folder in settings when a named folder may occur at arbitrary depth beneath a workspace folder.
  • Use forward slashes in patterns on every platform, including Windows.
  • Matching is case-insensitive by default on Windows and macOS, and case-sensitive on Linux. Remote workspaces follow the remote file system’s case sensitivity.
  • Search view include and exclude boxes differ from settings patterns: their ** prefix is assumed.

Check exclusions when search or navigation looks wrong

  1. Confirm the workspace roots. In a multi-root workspace, check which folders are open and whether the pattern is being evaluated relative to each root.
  2. Check the feature you changed. files.exclude affects Explorer visibility; search.exclude filters text search; files.watcherExclude affects watching.
  3. Inspect Search view filtering. Make sure “Use Exclude Settings and Ignore Files” is set as intended. When enabled, search respects matching .gitignore, files.exclude, and search.exclude entries.
  4. Test at multiple depths. Check the workspace root and a nested package, and verify directory-name capitalization on the local or remote file system where VS Code is running.
  5. Narrow rules if useful files disappear. Remove or constrain exclusions that hide source developers need to navigate, search, or index.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What exclusions can—and cannot—promise

Large folders may contribute to slow startup work, noisy search, watcher resource pressure, or limited IntelliSense functionality; these are distinct symptoms addressed by different settings. Excluding a folder can change what VS Code searches, watches, or indexes, but Microsoft’s documentation does not establish a universal performance improvement or benchmark for excluding a particular folder in a monorepo. Choose a narrow rule for the behavior you need and verify the effect in your workspace.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.