rust-lang / rust-lang/rust-analyzer
Rainbow brackets on type generics
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
VS Code's built-in TypeScript syntax highlighting supports rainbow brackets for type generics, as evidenced by this repro.
type Test = Array<Array<Array<string>>>;
Admittedly, only the left angle brackets are rainbowified on my system, though I have seen correct coloring in real code.
rust-analyzer, does not rainbowify angle brackets, as evidenced by this repro
type Test = Option<(String, Vec<(bool, String)>)>
Clearly, it is possible to have rainbow type generics, and I would like to see that in future. It would make reading complex types (such as session types for network communication protocols) easier.
Of course, this Test type is a bit silly, and cargo clippy does warn about complex types, suggesting layered aliasing to make them easier to read and understand. However, the added readability of rainbow brackets should not be ignored.
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
Reproduce the nested generic snippets from the issue in VS Code and rust-analyzer to compare bracket coloring. Locate rust-analyzer's syntax-highlighting handling for Rust generic angle brackets; done means nested type-generics receive rainbow coloring consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, typescript, vscode
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100