rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

Setting `rust-analyzer.workspace.symbol.search.scope` to `workspace_and_dependencies` produces bad results

Open thomaseizinger opened this issue 1 year ago • 0 comments

I am a VSCode user and I just learned about rust-analyzer.workspace.symbol.search.scope. Searching types from dependencies has been one of the features I really missed from IntelliJ.

Unfortunately, it appears that it is almost unusable in its current form. I am not sure what the sorting order is but it appears to be entirely random. I've also set rust-analyzer.workspace.symbol.search.scope to all_symbols and even when typing an exact symbol name from my local workspace, VSCode shows fuzzy-matched results from some my dependencies:

image

I think the results should be sorted by "distance" to the currently open file:

  • Matches in the local workspace
  • Matches in direct dependencies of the current crate
  • Matches in direct dependencies of any workspace crate
  • Matches in transitive dependencies

An MVP of the above could be to just prioritize workspace matches over dependency ones although I do think getting the order of results from dependencies right is also key.

A somewhat obvious one is also that full or at least partial matches should be prioritized over fuzzy-matched ones.

thomaseizinger avatar Feb 05 '24 04:02 thomaseizinger