rust-lang / rust-lang/rust-analyzer

Missing constant color highlighting inside `stringify!`

Open
#14,377 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-highlighting C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: 0.3.1435-standalone (f1e51afa4 2023-03-12)

rustc version: 1.70.0-nightly (ff4b772f8 2023-03-10)

relevant settings: Shouldn't be relevant to the bug per se, but I'm using this color theme.

While experimenting with macro_rules, I found the following weird behavior:
image

For some reason, when using an all-caps snake-case argument with the stringify!() macro that begins with a single all-cap letter followed by an underscore (I know, this is such a niche case that I won't be hurt if this gets backlogged forever), the corresponding argument isn't properly highlighted. I suspect this is an issue with semantic tokens (?) since the inspector shows the following:
image
image

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 by reproducing the reported macro_rules case involving an all-caps snake-case argument beginning with a single capital letter followed by an underscore. Inspect the semantic-token output using the editor's inspector, then investigate stringify! handling. Done means the corresponding argument receives the expected color highlighting.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.