Deep Exclude
Why this extension? Tools like explorer-exclude only hide files from the Explorer. If you exclude dist/ but it still shows up in full-text search results (Ctrl+Shift+F), that's the gap this extension fills. One exclusion list, synced everywhere.
Unified file/folder exclusion management for VS Code. Maintain a single list of glob patterns and sync them to Explorer, full-text search, and the file watcher — all at once, with independent toggles per target.
Features
- Syncs to full-text search — excluded files won't appear in Ctrl+Shift+F results (unlike explorer-exclude)
- Single exclusion list — one place to manage all your exclusion rules
- Sync to multiple targets — writes to
files.exclude, search.exclude, and files.watcherExclude simultaneously
- Independent toggles — enable/disable each sync target independently in settings
- Glob pattern support — files, folders, or any glob expression (e.g.
dist/)
- Built-in preset — common patterns pre-configured on first install
- Restore Defaults — reset to the built-in preset at any time
- Sidebar panel — view, toggle, and remove rules from the Explorer sidebar
- Right-click to exclude — right-click any file or folder in Explorer to add it
Usage
Add an exclusion rule
- Right-click a file or folder in Explorer → Exclude (Deep Exclude)
- Or: Command Palette → Deep Exclude: Add Pattern
Manage rules
Open the Excluded Items panel in the Explorer sidebar:
| Action |
How |
| Toggle a rule on/off |
Click the eye icon |
| Remove a rule |
Click the trash icon |
| Enable all |
Toolbar button (✓✓) |
| Disable all |
Toolbar button (✗✗) |
| Restore defaults |
Toolbar button (↺) |
| Open settings |
Toolbar button (⚙) |
Settings
| Setting |
Default |
Description |
deepExclude.syncToFilesExclude |
true |
Sync to files.exclude (Explorer, Quick Open, Symbol Search) |
deepExclude.syncToSearchExclude |
true |
Sync to search.exclude (full-text search) |
deepExclude.syncToWatcherExclude |
true |
Sync to files.watcherExclude (performance) |
deepExclude.respectGitignoreInExplorer |
false |
Hide .gitignore'd files from Explorer (sets explorer.excludeGitIgnore) |
deepExclude.respectGitignoreInSearch |
false |
Exclude .gitignore'd files from full-text search (sets search.useIgnoreFiles) |
Default preset
Language-agnostic entries only: .git/, .svn/, .hg/, CVS/, .DS_Store, Thumbs.db, desktop.ini, *.swp, *.tmp
Known Limitations
"Go to Symbol in Workspace" (Ctrl+T) results are controlled by language servers (e.g. tsserver for TypeScript), which maintain their own file index independently of files.exclude. Excluded files may still appear in symbol search results. This is a VSCode architectural limitation that cannot be addressed by extensions.
Tips: Respecting .gitignore
Enable deepExclude.respectGitignoreInExplorer and/or deepExclude.respectGitignoreInSearch in the extension settings to have VSCode respect your .gitignore file. Both settings are written to workspace scope only.
Attribution
Inspired by explorer-exclude-vscode-extension by sfccdevops (MIT). No code reused.
Deep Exclude(中文说明)
为什么要用这个插件? explorer-exclude 等工具只能隐藏 Explorer 中的文件。如果你排除了 dist/,但它仍然出现在全文搜索结果(Ctrl+Shift+F)中,这正是本插件解决的问题。一份排除列表,同步到所有地方。
统一管理 VS Code 文件/文件夹排除规则的插件。维护一份 glob 模式列表,同时同步到 Explorer、全文搜索和文件监听器,每个同步目标均可独立开关。
功能特性
- 同步到全文搜索 — 被排除的文件不会出现在 Ctrl+Shift+F 搜索结果中(explorer-exclude 做不到这点)
- 统一排除列表 — 所有排除规则在一处管理
- 多目标同步 — 同时写入
files.exclude、search.exclude、files.watcherExclude
- 独立开关 — 每个同步目标可在设置中单独启用/禁用
- Glob 模式支持 — 支持文件、文件夹或任意 glob 表达式(如
*.log、dist/)
- 内置预设 — 首次安装后自动加载常用排除规则
- 还原默认值 — 随时将规则列表重置为内置预设
- 侧边栏面板 — 在 Explorer 侧边栏中查看、切换和删除规则
- 右键排除 — 在 Explorer 中右键点击文件或文件夹即可添加排除规则
使用方法
添加排除规则
- 在 Explorer 中右键点击文件或文件夹 → Exclude (Deep Exclude)
- 或:命令面板 → Deep Exclude: Add Pattern
管理规则
打开 Explorer 侧边栏中的 Excluded Items 面板:
| 操作 |
方式 |
| 切换规则启用/禁用 |
点击眼睛图标 |
| 删除规则 |
点击垃圾桶图标 |
| 全部启用 |
工具栏按钮 |
| 全部禁用 |
工具栏按钮 |
| 还原默认值 |
工具栏按钮 |
| 打开设置 |
工具栏按钮 |
设置项
| 设置 |
默认值 |
说明 |
deepExclude.syncToFilesExclude |
true |
同步到 files.exclude(影响 Explorer、快速打开、符号搜索) |
deepExclude.syncToSearchExclude |
true |
同步到 search.exclude(影响全文搜索) |
deepExclude.syncToWatcherExclude |
true |
同步到 files.watcherExclude(文件监听器性能优化) |
deepExclude.respectGitignoreInExplorer |
false |
在 Explorer 中隐藏 .gitignore 里的文件(设置 explorer.excludeGitIgnore) |
deepExclude.respectGitignoreInSearch |
false |
在全文搜索中排除 .gitignore 里的文件(设置 search.useIgnoreFiles) |
内置预设
仅包含与语言无关的通用规则:.git/、.svn/、.hg/、CVS/、.DS_Store、Thumbs.db、desktop.ini、*.swp、*.tmp
已知限制
"Go to Symbol in Workspace"(Ctrl+T)符号搜索的结果由语言服务器(如 TypeScript 的 tsserver)控制,语言服务器维护独立的文件索引,不受 files.exclude 影响。被排除的文件仍可能出现在符号搜索结果中。这是 VSCode 架构层面的限制,插件无法解决。
提示:让 VSCode 遵守 .gitignore
在插件设置中启用 deepExclude.respectGitignoreInExplorer 和/或 deepExclude.respectGitignoreInSearch,即可让 VSCode 遵守 .gitignore 文件。两个开关均写入 workspace 层级。
致谢
本插件参考了 explorer-exclude-vscode-extension(sfccdevops,MIT 许可证)的交互设计,未使用其任何代码。