rust-lang / rust-lang/rust-analyzer

Add better hover messages for inert(builtin) attributes

Open
#10,945 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-hover A-ide C-feature
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
image

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.