Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow extensions to fully control workspace symbol search (matching and highlights) #98125

Open
sam-mccall opened this issue May 19, 2020 · 6 comments
Labels
api feature-request Request for new features or functionality quick-open Quick-open issues (search, commands) workspace-symbols
Milestone

Comments

@sam-mccall
Copy link

For qualified workspace-symbols queries like llvm::Str, our language server returns results like {containerName: "llvm", name: "StringRef"}.

VSCode attempts to fuzzy-match the query (llvm::Str) against the name only (StringRef). Because this always fails, it doesn't display any results.

In #23509 it's suggested this is something extensions should deal with, but it's not clear what extensions can do. The provideWorkspaceSymbols extension point must return SymbolInformation which are then filtered by name. Adding the qualifier to name means it is displayed twice - once in name and once in containerName.

@bpasero
Copy link
Member

bpasero commented May 20, 2020

I think this will be hard to get right because in your example there is :: used as separator and there is no way our fuzzy matcher would simply skip over this separator given it is very language specific.

I think the ideal solution is to let extensions not only return the matching symbols but also do the matching and return positions to highlight. We probably reached the end of what our generic solution can do.

@bpasero bpasero added feature-request Request for new features or functionality workspace-symbols api labels May 20, 2020
@bpasero bpasero changed the title Match workspace symbols query against containerName too Allow extensions to do workspace symbol search (matching and highlights) May 20, 2020
@bpasero bpasero removed their assignment May 20, 2020
@bpasero bpasero added the quick-pick Quick-pick widget issues label May 20, 2020
@bpasero bpasero changed the title Allow extensions to do workspace symbol search (matching and highlights) Allow extensions to fully control workspace symbol search (matching and highlights) May 20, 2020
@sam-mccall
Copy link
Author

@bpasero Thanks! A couple of other options too:

  • Splitting the query on the last run of punctuation would work well at least for the languages I'm familiar with: match the last segment against the name and previous text against containerName.
  • code completion is analogous and allows for providing filterText specifically for the purposes of matching. (Though AIUI this complicates display)

@gabro
Copy link

gabro commented Sep 17, 2021

Adding some more info about this, I've detailed our use case for Metals (the Scala language server) here (before realizing it was a duplicate issue) #133313

@mozhuanzuojing
Copy link

Looking forward to updating milestones, after all, this affects the developer experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api feature-request Request for new features or functionality quick-open Quick-open issues (search, commands) workspace-symbols
Projects
None yet
Development

No branches or pull requests

6 participants
@sam-mccall @gabro @bpasero @jrieken @mozhuanzuojing and others