rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
13.62k stars 1.49k forks source link

Wrong syntax highlight and definition of decl macro when working with `#[tokio::test]` proc-macro #17196

Open Jisu-Woniu opened 1 week ago

Jisu-Woniu commented 1 week ago

screenshot

As is shown in the picture, the last assert_eq! macro got a incorrect definition and syntax highlight.

rust-analyzer version: 0.3.1950-standalone

rustc version: rustc 1.78.0 (9b00956e5 2024-04-29)

editor or extension: VS Code 1.89.0, rust-analyzer extension v0.3.1950 on Arch Linux

relevant settings: Don't remember

code snippet to reproduce:

src/lib.rs

#[cfg(test)]
mod tests {

    #[tokio::test]
    async fn it_works() {
        assert_eq!(2, 2);
        assert_eq!(4, 4);
    }
}

Cargo.toml:

[package]
name = "demo"
version = "0.1.0"
edition = "2021"

[dependencies]
tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread"] }