-
Notifications
You must be signed in to change notification settings - Fork 118
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
Poor result ranking for workspaceSymbol #81
Comments
This is unfortunate and it looks like vscode is tripping us over somehow. Moving the issue into vscode-clangd.
|
Yeah, I'm happy to add a Any ideas before we close this? |
The question is where the order is lost. Can barely find the relevant code in vscode, only this |
The protocol doesn't really incorporate ranking. As with code completion, most clients respect what the server sends, but VSCode re-ranks items, with predictable results. See clangd/vscode-clangd#81 There's no filterText field so we may be unable to construct a good workaround. But expose the score so we may be able to do this on the client in future. Differential Revision: https://reviews.llvm.org/D88844
It looks like the culprit is our fix for #31. What VSCode appears to be doing is:
(I'm basing this on experimentation, I haven't tracked down the relevant VSCode source.) So, if This is indeed how the server provides the symbols. However, we added middleware code to the client to manipulate the server results in the following way: provideWorkspaceSymbols: async (query, token, next) => {
let symbols = await next(query, token);
return symbols.map(symbol => {
if (symbol.containerName)
symbol.name = `${symbol.containerName}::${symbol.name}`;
// Always clean the containerName to avoid displaying it twice.
symbol.containerName = '';
return symbol;
})
}, By including the qualifier in |
I proposed a fix which limits the manipulation added for #31, to just the cases where the query string is in fact qualified. That should solve the problem for the vast majority of cases. (Technically, the problem can still occur for partially-qualified query strings, but those are much less likely to have a mixture of exact and partial matches.) |
The protocol doesn't really incorporate ranking. As with code completion, most clients respect what the server sends, but VSCode re-ranks items, with predictable results. See clangd/vscode-clangd#81 There's no filterText field so we may be unable to construct a good workaround. But expose the score so we may be able to do this on the client in future. Differential Revision: https://reviews.llvm.org/D88844
The protocol doesn't really incorporate ranking. As with code completion, most clients respect what the server sends, but VSCode re-ranks items, with predictable results. See clangd/vscode-clangd#81 There's no filterText field so we may be unable to construct a good workaround. But expose the score so we may be able to do this on the client in future. Differential Revision: https://reviews.llvm.org/D88844
If I'm editing the LLVM codebase with vscode + clangd and I perform a
workspaceSymbol
search forTypeDecl
, this is what I get:Note that
clang::TypeDecl
is the very last result, and all sorts of identifiers where the leaf segment is only a partial as opposed to an exact match are ranked higher than it.I believe this is clearly suboptimal. Symbols where the leaf segment of the qualified name is an exact match should be ranked higher than ones where it's a partial match.
The text was updated successfully, but these errors were encountered: