rust-lang / rust-lang/rust-analyzer
Add AST-based fallback path for symbols
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Symbol search is functionality which allows you to enter query like Aex and get fuzzy search results for all symbols with matching name (like AstExpr). Originally, it was syntax based, but that was missing symbols declared by macros. In https://github.com/rust-lang/rust-analyzer/pull/10872 we rewrote the infra to be based on semantics. This generally works much better, but has one drawback: if we don't have semantic information for a file, we don't get symbols for it.
There are three cases where we lack semantics:
- when file is not a part of the module tree
- when the project model is broken (typo in Cargo.toml)
- when we are just loading the project
For all three cases, it would be much better if we fell back on the older, syntax based infra.
I think the logic we want here is:
- collect all semantic modules
- collect all semantic symbols from modules
- collect all files (which doesn't require semantic info)
- key idea: for each file, which isn't a file of some module, collect syntactic symbols
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the semantic and syntax-based symbol-search infrastructure described in rust-analyzer#10872, then trace how semantic modules and files are collected. Implement the fallback for files that are not part of a semantic module, and verify that semantic symbols remain unchanged while those files contribute syntactic symbols.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools, search
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100