Skip to content

fix(search): avoid hanging on custom FS schemes without a search provider (#260035)#310776

Open
maruthang wants to merge 2 commits into
microsoft:mainfrom
maruthang:fix/issue-260035-search-inmemory-fs-hang
Open

fix(search): avoid hanging on custom FS schemes without a search provider (#260035)#310776
maruthang wants to merge 2 commits into
microsoft:mainfrom
maruthang:fix/issue-260035-search-inmemory-fs-hang

Conversation

@maruthang
Copy link
Copy Markdown
Contributor

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.searchWithProviders awaited waitForProvider on 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 via extensionService.whenInstalledExtensionsRegistered()), skip the scheme with a warning instead of waiting on a deferred promise that will never resolve. Normal file:// scheme behavior is unchanged because a search provider is always registered before file is queried.

Test plan

  • Added src/vs/workbench/services/search/test/common/searchService.test.ts — builds a SearchService with a mocked TestFileService where hasProvider(memfs) === true, issues a memfs:/ text query, and asserts it completes (empty results) within 2s. Pre-fix this would time out.
  • Manual repro: open the fsprovider-sample extension in VS Code, open the MemFS workspace, 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-native passes cleanly.

Fixes #260035

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 consider fileService.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.ts that asserts a memfs:/ 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search not working on in-memory file systems

3 participants