rust-lang / rust-lang/rust-analyzer

macro_rules! semantic highlighting

Open
#6,232 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-highlighting A-macro E-hard fun S-actionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

It would be nice to have semantic highlighting for macro_rules! in regards to metavariables( and maybe fragment types) as well as repetitions.

macro_rules! mac {
    ( $metavar:ident $( bar $baz:ident)+ ) => {}
}

The question is whether the dollar $ should be be highlighted as a metavariable or a punctuation character. In regards to $( bar $baz:ident)+, if the punctuations are highlighted as mere punctuations then repetitions won't really have anything that would allow them to be lit.

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 tracing rust-analyzer's semantic-highlighting handling for macro_rules! metavariables, fragment types, and repetitions. Review how the $ and repetition punctuation are currently classified, then determine the intended token categories and verify the resulting highlighting with focused tests. Done means these macro constructs receive consistent semantic highlighting.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.