rust-lang / rust-lang/rust-analyzer

Improve completion of macro_rules partial inputs

Open
#20,623 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

rust-analyzer version: rust-analyzer 1.91.0-nightly (040a98a 2025-08-20)

rustc version: rustc 1.91.0-nightly (040a98af7 2025-08-20)

editor or extension: coc-rust-analyzer

code snippet to reproduce:

macro_rules! vec_like {
    ($($e:expr),+ $(,)?) => {
        [$($e),+]
    };
}

fn main() {
    vec_like!("".|);
}

| is cursor

Unable to complete when entering the dot, as it cannot be fully parsed as expr

But there are no other matching branches at this point,
should we try inputting the incomplete expr into the macro_rules?

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 running the Rust snippet from the issue in rust-analyzer with the cursor after the dot and observe the missing completion. Trace the macro_rules completion path for partially parsed expr inputs; done means completion is offered at this cursor position without requiring the expression to parse fully.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.