Skip to content

Implement user configurable search exclusion patterns preference#17011

Open
cdamus wants to merge 3 commits intoeclipse-theia:masterfrom
cdamus:feature/16775-search-excluded
Open

Implement user configurable search exclusion patterns preference#17011
cdamus wants to merge 3 commits intoeclipse-theia:masterfrom
cdamus:feature/16775-search-excluded

Conversation

@cdamus
Copy link
Contributor

@cdamus cdamus commented Feb 17, 2026

What it does

Resolves #16775. Introduces a centralized WorkspaceSearchFilterService in @theia/workspace that aggregates search exclusion glob patterns from multiple WorkspaceSearchFilterProvider contributions, replacing duplicated logic across
consumers.

Previously, both SearchInWorkspaceResultTreeWidget.getExcludeGlobs() and QuickFileSelectService independently read and merged the files.exclude preferences, duplicating the inheritance logic. This PR:

  • Adds a WorkspaceSearchFilterProvider contribution point and WorkspaceSearchFilterService in @theia/workspace that aggregates and caches exclusion globs from all registered providers.
  • Binds a WorkspaceFilesExcludeFilterProvider (for files.exclude preference) in @theia/workspace.
  • Adds a search.exclude preference to @theia/search-in-workspace (matching VS Code's setting, defaulting to "**/node_modules": true) and binds a SearchExcludeFilterProvider for it.
CleanShot 2026-02-17 at 16 50 20
  • Simplifies SearchInWorkspaceResultTreeWidget, SearchInWorkspaceWidget, and QuickFileSelectService to consume the service instead of reading preferences directly.
  • In the Search view, replaces the "Include Ignored Files" toggle that was in the search-text field with a "Use Exclude Settings and Ignore Files" toggle in the exclude-files field, with inverted semantics and the same icon as Theia used previously.
CleanShot 2026-02-17 at 16 51 37
  • Fixes the files.watcherExclude preference to use markdownDescription so its glob pattern link renders correctly.

How to test

  1. Open the Search in Workspace view and perform a search. Verify results respect files.exclude and search.exclude patterns from the preferences.
  2. Change files.exclude in settings — search results should update automatically.
  3. Change search.exclude in settings — search results should update automatically.
  4. Toggle "Use Exclude Settings and Ignore Files" off (the icon button next to the exclude files input) — all exclusion patterns should be ignored and previously hidden results should appear.
  5. Use Quick Open (Ctrl/Cmd+P) file search — verify excluded files are hidden, matching the same exclusion patterns.
  6. Press Ctrl/Cmd+P again to turn off the exclusion settings and verify that more files are shown in the picker from locations that previously were excluded

Note

If you are testing Theia in the theia repository, you may be confused to see that the new search.exclude preference shows as overridden in the workspace, despite that there is no mention of it in .theia/settings.json. This happens because the setting is present in .vscode/settings.json. Attempting to reset the setting via the gear button has no effect, but when you click to modify the setting the VSCode value is copied into .theia/settings.json so at least that is sort-of plausible. But IMO this is all a bug: the VSCode settings should not be used the Theia at all because Theia is not VSCode. But that's not in scope of the issue at hand.

Follow-ups

None currently identified.

Breaking changes

  • This PR introduces breaking changes and requires careful review. If yes, the breaking changes section in the changelog has been updated.

See the changelog entry for details. In summary:

  • SearchInWorkspaceResultTreeWidget: filesystemPreferences replaced by searchFilterService; getExcludeGlobs() signature changed.
  • SearchInWorkspaceWidget: includeIgnoredState renamed to useExcludeSettingsState with inverted semantics; FileSystemPreferences injection replaced by searchFilterService.
  • QuickFileSelectService: fsPreferences replaced by searchFilterService; new getExcludePatterns() method.

Attribution

Review checklist

Reminder for reviewers

- fix declaration of the files.watcherExclude preference to account for
  it being markdown-formatted
- include the same link for glob patterns in the files.exclude
  preference description as in watcherExclude

Signed-off-by: Christian W. Damus <cdamus@eclipsesource.com>
@github-project-automation github-project-automation bot moved this to Waiting on reviewers in PR Backlog Feb 17, 2026
@cdamus cdamus changed the title Feature/16775 search excluded Implement user configurable search exclusion patterns preference Feb 17, 2026
- implement a new "search.exclude" preference for a list of patterns to
  exclude from searches
- move the "Include Ignored Files" toggle button from the search field
  to the exclusions field in the search details, reverse its polarity,
  and retitle it as "Use Exclude Settings and Ignore Files"
- use the exclude patterns preference in addition to excluding ignored
  files when this option is toggled on, which it is by default
- plausibly migrate UI state from a previous installation's "Include
  Ignored Files" setting
- use the new preference also in the quick open UI

To maintain hygienic package dependencies, the Workspace package defines
a new WorkspaceSearchFilterService that all searching components use to
access the glob patterns for files in the workspace to exclude from
search. Contributions are provided from the packages that define the
preferences for general file exclusions and for search exclusions to
wrap their preferences in this new service.

Fixes eclipse-theia#16775

Signed-off-by: Christian W. Damus <cdamus@eclipsesource.com>
Signed-off-by: Christian W. Damus <cdamus@eclipsesource.com>
@cdamus cdamus force-pushed the feature/16775-search-excluded branch from 18af5e9 to bc534c0 Compare February 17, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting on reviewers

Development

Successfully merging this pull request may close these issues.

Add "Use exclude settings and ignore files" option in Search View

1 participant