rust-lang / rust-lang/rust-analyzer

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

Open
#16,491 5 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-vscode S-blocked
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the implementation and results produced for rust-analyzer.workspace.symbol.search.scope in the VSCode integration. Reproduce searches with workspace_and_dependencies and all_symbols, then compare the observed ordering with the requested workspace, dependency-distance, and exact-match priorities; done means relevant local and exact or partial matches consistently rank ahead of less relevant fuzzy results.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, vscode
Domain
developer-experience, devtools, search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.