Skip to content

Go-to-definition and auto-completion inside a macro_rules invocation #14999

@LukeMathWalker

Description

@LukeMathWalker

In Pavex, there is a f! macro. It desugars to

macro_rules! f {
    ($($p:tt)*) => {{
        $crate::reflection::RawCallable {
            import_path: stringify!($($p)*),
            registered_at: ::std::env!("CARGO_PKG_NAME")
        }
    }};
}

The expectation is that the argument passed to f! is a path to a Rust type (either a method or a function).

In RA, as soon as you are writing inside the f! context (e.g. f!(crate::...)), you don't get any autocompletion.
Once the path is full spelled out (e.g. f!(crate::get_articles)), you also don't get the "go to definition" assist.

Is there a way to improve the experience here? Is there something that I can do, as the macro author, to help RA in dealing with this case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-featureCategory: feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions