Repository navigation
Support exclude exceptions in the Settings editor and settings.json - #345013
Draft
Logan Ramos (lramos15) wants to merge 15 commits into
Draft
Logan Ramos (lramos15) wants to merge 15 commits into
Logan Ramos (lramos15) wants to merge 15 commits into
Conversation
A `!`-prefixed key in files.exclude or search.exclude now marks an exception: matching paths and everything inside them are not excluded, even when another pattern or .gitignore excludes them. Exceptions never add exclusions and do not depend on key order, so settings scopes still merge as before, and `false` keeps disabling a key. Expressions without exceptions parse exactly as before. The explorer shows the folders that lead to an exception, search re-includes excepted paths with an extra ripgrep run per exception root, and the Settings editor gains an Add Exception action plus a quick fix for `"pattern": false` entries that disable nothing. Other glob settings and the extension API keep treating `!` literally. Fixes #869 Co-authored-by: Copilot <[email protected]>
- Do not let exception-run text matches that are filtered out use up the result limit - Evaluate web search excludes once, with folder exceptions, instead of re-checking global excludes per file - Treat brace alternatives with a path separator as variable length when pruning folders - Apply absolute exceptions that start with the searched folder in ripgrep runs and in the post-filter - Do not infer existence from the exit code of an exception run - Keep exceptions relative in the breadcrumbs picker - Resolve exception run roots to their casing on disk and skip roots that pass through a symbolic link when links are not followed - Only remember excepted paths of the main ripgrep run for deduplication, and avoid repeated configuration lookups in settings.json diagnostics Co-authored-by: Copilot <[email protected]>
Exceptions no longer look into version control folders such as .git unless an exception names them, in search runs and in the explorer, and settings.json flags exceptions that make search walk the whole folder. Co-authored-by: Copilot <[email protected]>
- Keep files below excluded folders hidden in the breadcrumbs picker when it shows a folder that leads to an exception - Apply relative and absolute exceptions in the quick open history matcher, whichever path the exclude matched - Do not offer converting a false pattern into an existing exception key, and inspect local and remote user settings separately - Only describe ! patterns as exceptions in the Settings editor for settings that support them - Resolve exception run roots case-insensitively when globs ignore case, starting from the closest unambiguous folder - Treat an absolute exception for the searched folder itself as the whole folder Co-authored-by: Copilot <[email protected]>
- Search the paths that exceptions re-include with a single pruned ripgrep run per folder (`-g '!*'` plus the path components of each exception) instead of one run per literal prefix, which removes root resolution for casing, symbolic links and missing folders - Share one tree walk helper, `evaluateExcludeTreeEntry`, between the explorer, breadcrumbs, file walkers and search providers - Only support folder-relative exceptions; absolute `!` keys are ignored - Move the Settings editor and settings.json changes to a follow-up PR Co-authored-by: Copilot <[email protected]>
- The exclude list widget in the Settings editor shows `!` keys as exceptions, with a dedicated "Add Exception" button - settings.json flags `"pattern": false` entries that disable nothing, with a quick fix to convert them into an exception, and flags exceptions that are ignored because they are absolute or that make search walk the whole folder Co-authored-by: Copilot <[email protected]>
Whitelisting the folders that lead to an exception with globs such as `**` listed every file, so a text search read all files when an exception starts with `**`. Folders that lead to an exception now use folder-only globs, and runs for exceptions that can match at any depth only whitelist the exceptions. Co-authored-by: Copilot <[email protected]>
- Limit accepted text search results to the default limit when the query
does not specify one, so results of exclude exception runs, which are not
limited by ripgrep, stay bounded and report `limitHit`
- Expand brace groups when finding the version control folders that an
exception names, so `!{.git,.hg}/hooks` looks into both folders
- Test that exceptions with a `..` segment do not search outside the folder
Co-authored-by: Copilot <[email protected]>
…-globs-explanation # Conflicts: # src/vs/workbench/test/common/resources.test.ts
- Check text search results of the exception run against the exceptions,
because ripgrep globs can match more than VS Code globs (`**.js`), and
skip folders of the query that are inside the searched folder, as file
search does
- Keep version control folders excluded under an exception unless an
exception names them, so the explorer and the JS search paths agree
with ripgrep
- Traverse folders for exceptions with a globstar inside braces, such as
`{**,foo}/keep.txt`
- Apply folder-relative exceptions when an absolute exclude pattern
matches in quick open history
- Record the exclude exception time before the search completes
Co-authored-by: Copilot <[email protected]>
…code-negated-globs-settings-ui
- Only traverse every folder for a brace alternative that is a globstar,
such as `{**,foo}`; `**` within a segment, as in `**.js`, matches a
single segment
- Find the folders of a text query that are inside a folder with the
glob case setting, as file search does, so differently cased nested
folders are skipped by the exclude exception run
Co-authored-by: Copilot <[email protected]>
…code-negated-globs-settings-ui
Explorer Find dropped folder hits that `.gitignore` hides even when the explorer shows them because an exclude exception matches beneath them. Co-authored-by: Copilot <[email protected]>
…code-negated-globs-settings-ui
Base automatically changed from
agents/vscode-negated-globs-explanation
to
main
October 30, 2026 16:33
3 tasks done
This branch has not been deployed
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.
Follow-up to #344980 (stacked on it), split out to keep the core change focused. Refs #869.
Changes
files.exclude/search.excludeshows!-prefixed keys as exceptions ("Do not exclude files matching …") and adds an Add Exception button that starts a new pattern with!."pattern": falsethat does not disable a pattern from another scope: Info, with a Convert to Exception quick fix (skipped when the!patternkey already exists)."!/workspace/keep.js": true: Warning, because exceptions are folder-relative and absolute ones are ignored.**: Info, because search walks the whole folder to find them.How to test
!node_modules/@types."files.exclude": { "foo": false, "!/abs/path": true, "!**/Scripts": true }and check the markers and the quick fix on"foo": false.Validation
npm run typecheck-client: passednpm run eslint -- <changed preferences files>: passed./scripts/test.sh --runGlob "**/contrib/preferences/test/**/*.test.js": passed (135 tests)