fix(search): avoid hanging on custom FS schemes without a search provider (#260035)#310776
Open
maruthang wants to merge 2 commits into
Open
fix(search): avoid hanging on custom FS schemes without a search provider (#260035)#310776maruthang wants to merge 2 commits into
maruthang wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a hang in search when the workspace uses a custom file-system scheme (e.g. memfs:/) that has an IFileSystemProvider but no dedicated search provider. Previously SearchService.searchWithProviders would await waitForProvider(...) on a deferred promise that was never resolved, leaving the search spinner (and Copilot agent text searches) hanging forever.
Changes:
- In
searchWithProviders, when no search provider exists for a scheme, also considerfileService.hasProvider(scheme)and skip the scheme (with a warning) instead of waiting indefinitely. - Updated the warning message to distinguish the two skip reasons (another scheme has a provider vs. only an FS provider is registered).
- Added a new
searchService.test.tsthat asserts amemfs:/text query completes (does not hang) when only an FS provider is registered.
Show a summary per file
| File | Description |
|---|---|
src/vs/workbench/services/search/common/searchService.ts |
Skip schemes with only an FS provider registered to avoid awaiting a never-resolved deferred; refined warning message. |
src/vs/workbench/services/search/test/common/searchService.test.ts |
New unit test verifying textSearch returns promptly (empty results) for a scheme with only an FS provider. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
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
Search no longer hangs when the only workspace scheme is a custom file-system provider (e.g.
memfs:/) that doesn't register a dedicated search provider.Why
SearchService.searchWithProvidersawaitedwaitForProvideron a deferred promise that would never resolve for extensions that register only an FS provider — the spinner stayed up forever. This also stalls Copilot agent-mode text searches on such workspaces.How
When no search provider is registered for a scheme, also check
fileService.hasProvider(scheme). If an FS provider is already present (extensions are awaited earlier viaextensionService.whenInstalledExtensionsRegistered()), skip the scheme with a warning instead of waiting on a deferred promise that will never resolve. Normalfile://scheme behavior is unchanged because a search provider is always registered beforefileis queried.Test plan
src/vs/workbench/services/search/test/common/searchService.test.ts— builds aSearchServicewith a mockedTestFileServicewherehasProvider(memfs) === true, issues amemfs:/text query, and asserts it completes (empty results) within 2s. Pre-fix this would time out.fsprovider-sampleextension in VS Code, open theMemFSworkspace, and run a text search — pre-fix the spinner hangs forever; post-fix the search completes immediately with a warning logged for the unsupported scheme.npm run compile-check-ts-nativepasses cleanly.Fixes #260035