rust-lang / rust-lang/rust-analyzer
Flowistry like feature
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Flowistry is a very cool and useful tool that gray out codes that are not related to the code under cursor. Now that we have a functioning MIR, we can implement a similar feature in rust-analyzer. The flowistry paper explains how it works, and it's internal analysis is published as a crate but I don't think we can reuse that much since it is heavily dependent on the rustc internals. A challenge in reimplementing that in r-a is that we ignore lifetime annotations currently in type lowering, but I think it wouldn't create problems for start, we can assume all lifetimes are static at cost of some false positive gray areas. Another challenge is constructing a ast to mir map, for finding the mir node under cursor.
But why we should implement it in rust-analyzer when flowistry already exists? Implementing it in rust-analyzer has some benefits:
- Flowistry focus mode will be disabled if you change the code, limiting its usability.
- It's start time is a bit slow.
- It needs nightly, which doubles the target folder size, and has other nightly problems.
- It only supports vscode, but r-a is cross editor.
- It's discoverability is a little lower than r-a.
cc @willcrichton
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 with the Flowistry paper and its published analysis crate to understand the requested behavior. Then inspect rust-analyzer's existing MIR and type-lowering work, focusing on the stated challenge of mapping AST locations to MIR nodes. Done would require a scoped design and an implemented cross-editor equivalent of Flowistry's focus mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100