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.