-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
rust-analyzer version: 65fbe0a 2022-04-18 stable
rustc version: rustc 1.60.0 (7737e0b5c 2022-04-04)
relevant settings: -
When annotating function with proc-macro, resolving references inside such a function does not behaves as expected:
- Variable references are no longer highlighted
- Pressing "Go to definition" on variable declaration does not open reference list
In my case, this is tracing::instrument
proc macro.
Code example:
struct Struct { field: i32 }
#[tracing::instrument]
fn test_with_instrumentation() {
let variable = Struct { field: 42 };
variable.field;
variable.field;
}
fn test_without_instrumentation() {
let variable = Struct { field: 42 };
variable.field;
variable.field;
}
Here how it looks like in function that is not annotated:
You can see that I can get a list of references (when executing go to definition on variable declaration) and references are highlighted with gray box.
Here how it looks like in function that is annotated:
Go to definition does nothing, and references are not highlighted.
However if I try go to definition on one of usages, it will jump me to declaration.
I tried to add this configuration in VS Code, but it did not made any difference:
"rust-analyzer.procMacro.ignored": {
"tracing": [
"instrument"
]
}