feat: respect built-in files.exclude / search.exclude (#31)#83
Merged
Conversation
Add a `relativePath.useBuiltInExcludes` setting so the picker can also honor VS Code's built-in `files.exclude` and/or `search.exclude`, letting users avoid duplicating those globs in `relativePath.ignore`. - collectBuiltInExcludes() reads the enabled globs (value === true) from either/both settings and, for folder-style globs, adds the `/**` descendant form so the file-creation watcher matches contents the same way findFiles prunes them. - The merged list feeds both the findFiles scan and the watcher. - The config watcher rescans when the mode changes, or when files.exclude / search.exclude change while the mode is active. - buildExcludeGlob now dedupes and emits a single glob bare (a one-item brace is not alternation). Defaults to "none", so existing behavior is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Honor VS Code's built-in files.exclude and search.exclude out of the box, so users get sensible excludes without duplicating them into relativePath.ignore. Set the new setting to "none" to restore the prior behavior of using only relativePath.ignore. This changes default behavior: files under files.exclude / search.exclude are now hidden from the picker unless opted out. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…oolean The four-value enum over-promised. VS Code's findFiles always applies files.exclude to the scan (short of a null exclude, which would also drop our own ignore globs), so the "none" and "files" modes were misleading: files.exclude can't be turned off for the scan, and adding it there is a no-op. The only genuine user choice is whether to also honor search.exclude, which findFiles never applies on its own. - New boolean `relativePath.respectSearchExclude` (default true) gates search.exclude. - files.exclude is now always merged into the ignore globs so the file creation watcher stays consistent with the scan VS Code already prunes. - collectBuiltInExcludes(mode, files, search) becomes the single-source collectExcludeGlobs(exclude). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a new
relativePath.useBuiltInExcludessetting so the picker can also honor VS Code's built-infiles.excludeand/orsearch.exclude, letting users avoid duplicating those globs inrelativePath.ignore.Closes #31.
The setting
relativePath.useBuiltInExcludes(string enum, default"none"):none(default)relativePath.ignore(unchanged behavior)filesfiles.excludesearchsearch.excludebothThis matches the API shape requested in the issue thread (choose to follow both or either).
How it works
collectBuiltInExcludes()reads the enabled globs (value === true) from the chosen source(s). Entries set tofalse(a user re-including a path) and{ when }sibling clauses are skipped, since we can't cheaply resolve the latter.**/node_modules(no trailing/**).findFilesprunes that folder's contents, but the file-creation watcher matches file paths directly, so for each folder glob we also add the/**descendant form. This keeps files created after the initial scan inside an excluded folder out of the cache. Appending/**to a file-name pattern like**/*.pycis harmless (it just never matches).findFilesscan and the creation watcher, so they stay consistent.files.exclude/search.excludechange while the mode is active.buildExcludeGlobnow dedupes and emits a single glob bare (a one-item brace{a}is not alternation, so it would otherwise be read literally).Defaults to
"none", so existing users see no change unless they opt in.Testing
collectBuiltInExcludes(each mode,true-only filtering,when-clause skipping, descendant-form handling) and thebuildExcludeGlobdedupe / single-glob cases.tsctypechecks clean.The pure exclude-merging logic is fully unit-tested; the VS Code wiring (findFiles / watcher / config-change rescan) compiles and follows the existing patterns. It was verified via typecheck + unit tests rather than launching the Extension Development Host, which needs an interactive GUI.
🤖 Generated with Claude Code