Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poor completion in tracing crate macros #18719

Closed
SludgePhD opened this issue Dec 19, 2024 · 1 comment · Fixed by #18723
Closed

Poor completion in tracing crate macros #18719

SludgePhD opened this issue Dec 19, 2024 · 1 comment · Fixed by #18723
Assignees
Labels
C-bug Category: bug

Comments

@SludgePhD
Copy link

rust-analyzer version: 0.3.2220-standalone

rustc version: any recent

editor or extension: VSCode, but shouldn't matter

relevant settings: none

repository link (if public, optional): https://github.com/tokio-rs/tracing

code snippet to reproduce:

let variable = "test";
tracing::info!(var<|>);
tracing::info!(name = var<|>);

Requesting completions in the two places in the snippet above comes up empty, but this is a valid place to put the variable local, which tracing will then emit as an event.

let variable = "test";
tracing::info!("{}", va<|>);

In this snippet, the info! macro is used just like log::info! can be, except with the log crate, rust-analyzer does manage to provide proper completions.

A fix for these would be great, since tracing is heavily favored over log in large parts of the ecosystem (eg. the whole async ecosystem, and bevy uses it too).

@SludgePhD SludgePhD added the C-bug Category: bug label Dec 19, 2024
@ChayimFriedman2 ChayimFriedman2 self-assigned this Dec 19, 2024
@ChayimFriedman2
Copy link
Contributor

Minimized:

macro_rules! helper {
    ($v:ident) => {};
}

macro_rules! m {
    ($v:ident) => {{
        helper!($v);
        $v
    }};
}

fn main() {
    let variable = "test";
    m!(v|);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants