rust-lang / rust-lang/rust-analyzer
Add better hover messages for inert(builtin) attributes
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
We now show a very short hover messsage for builtin attributes showing their valid use forms like

This is currently directly taken from https://github.com/rust-analyzer/rust-analyzer/blob/7d6fcbc0be2151bfa85ec146545b42d8be2fb28c/crates/hir_def/src/builtin_attr.rs#L103-L508 which is just copied from rustc. This is obviously not too helpful and some of these attributes could definitely benefit from having a nicer hover message that explains them in more detail, prime candidate being #[cfg]. Now these attributes don't really have official documentation(aside from random places in the reference) and as such we would have to hardcode these.
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 referenced builtin_attr.rs attribute definitions and the Rust Reference's conditional-compilation documentation. Identify which builtin attributes, especially #[cfg], need expanded hover text and determine the useful details to present. Done means builtin attributes show informative hover messages rather than only their valid-use forms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100