Implement user configurable search exclusion patterns preference#17011
Open
cdamus wants to merge 3 commits intoeclipse-theia:masterfrom
Open
Implement user configurable search exclusion patterns preference#17011cdamus wants to merge 3 commits intoeclipse-theia:masterfrom
cdamus wants to merge 3 commits intoeclipse-theia:masterfrom
Conversation
- 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>
- 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>
18af5e9 to
bc534c0
Compare
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 it does
Resolves #16775. Introduces a centralized
WorkspaceSearchFilterServicein@theia/workspacethat aggregates search exclusion glob patterns from multipleWorkspaceSearchFilterProvidercontributions, replacing duplicated logic acrossconsumers.
Previously, both
SearchInWorkspaceResultTreeWidget.getExcludeGlobs()andQuickFileSelectServiceindependently read and merged thefiles.excludepreferences, duplicating the inheritance logic. This PR:WorkspaceSearchFilterProvidercontribution point andWorkspaceSearchFilterServicein@theia/workspacethat aggregates and caches exclusion globs from all registered providers.WorkspaceFilesExcludeFilterProvider(forfiles.excludepreference) in@theia/workspace.search.excludepreference to@theia/search-in-workspace(matching VS Code's setting, defaulting to"**/node_modules": true) and binds aSearchExcludeFilterProviderfor it.SearchInWorkspaceResultTreeWidget,SearchInWorkspaceWidget, andQuickFileSelectServiceto consume the service instead of reading preferences directly.files.watcherExcludepreference to use markdownDescription so its glob pattern link renders correctly.How to test
files.excludeandsearch.excludepatterns from the preferences.files.excludein settings — search results should update automatically.search.excludein settings — search results should update automatically.Note
If you are testing Theia in the
theiarepository, you may be confused to see that the newsearch.excludepreference 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.jsonso 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
See the changelog entry for details. In summary:
SearchInWorkspaceResultTreeWidget:filesystemPreferencesreplaced bysearchFilterService;getExcludeGlobs()signature changed.SearchInWorkspaceWidget:includeIgnoredStaterenamed touseExcludeSettingsStatewith inverted semantics;FileSystemPreferencesinjection replaced bysearchFilterService.QuickFileSelectService:fsPreferencesreplaced bysearchFilterService; newgetExcludePatterns()method.Attribution
Review checklist
nlsservice (for details, please see the Internationalization/Localization section in the Coding Guidelines)Reminder for reviewers