microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.44k stars 28.62k forks source link

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

Open sam-mccall opened 4 years ago

sam-mccall commented 4 years ago

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 commented 4 years ago

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.

sam-mccall commented 4 years ago

@bpasero Thanks! A couple of other options too:

gabro commented 2 years ago

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) https://github.com/microsoft/vscode/issues/133313

mozhuanzuojing commented 2 years ago

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