Skip to content

Highlighting of format_args! does not work with tracing macros #12405

@ian-h-chamberlain

Description

@ian-h-chamberlain

Syntax highlighting in macros like println! and format_args! is awesome! Unfortunately, it doesn't seem to work with tracing macros as I would expect it to, since the expansion appears to use format_args! similarly to other cases. Example:

Screen Shot 2022-05-28 at 9 00 54 AM

So far, I have not been able to reproduce this using my own macro definition, and the upstream tracing::event has a fairly big + complicated definition, but one match arm does use format_args! and the expansion contains this:

Some(
    &(unsafe {
        std::fmt::Arguments::new_v1(
            &[],
            &[std::fmt::ArgumentV1::new(
                &("not highlighted"),
                std::fmt::Display::fmt,
            )],
        )
    }) as &Value,
),

Please let me know if there's anything I can do to help track down why this expansion doesn't match the criteria for highlighting. Thanks!


rust-analyzer version: rust-analyzer version: 84be2ea 2022-05-23 stable

rustc version: rustc 1.61.0 (fe5b13d68 2022-05-18)

relevant settings: None that I know of

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-highlighting(semantic) token highlightingA-macromacro expansionC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions