Skip to content

Expose workspace search query to extensions #307972

@arpitjp

Description

@arpitjp

I am building a custom webview editor for markdown, but there is no good way to integrate it with global search.

When a user clicks a search result, extensions can see the file and range that opened, but not:

  • what search query produced it
  • whether it came from global search
  • what the current search state is

If extensions could access the current search query and maybe some search result context, a custom editor/webview could use that to run its own search logic and show matching results too.

That would make global search work much better with custom editors and previews.

Even something small like this would help:

vscode.search.getCurrentQuery(): string | undefined

Or:

vscode.search.onDidOpenSearchResult(({ query, uri, range }) => {})

Longer term, it could be nice if the same search UI could be reused for both built-in and custom search providers, at either global or file level, while extensions implement their own search logic.

Happy to contribute if this sounds reasonable.

Metadata

Metadata

Assignees

Labels

apifeature-requestRequest for new features or functionalitywebviewWebview issues

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions