-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Highlighting of format_args! does not work with tracing macros #12405
Comments
I know this issue hasn't seen much movement since I first filed it, but I had some renewed interest after seeing #15559 in the recent weekly changelog. Good news: I was able to find a minimum viable reproduction! Using macro_rules! nothing {
($tt:tt) => {};
}
macro_rules! expand_multiple {
($fmt:literal) => {{
format_args!($fmt);
nothing!($fmt);
}};
}
fn main() {
let some_val = "okay";
expand_multiple!("reproduces: {some_val}");
} When I'm not sure if this is really supported, since of course macros can do whatever they want with the literal, but I'd suggest that usually, if any part of the expansion is |
Yes, syntax highlighting currently only looks at the first (as in iteration order) mapping it encounters for performance reasons. That might change in the future as we are rewriting some of the mapping stuff soon. |
Just out of curiosity, which PR / commit fixed this issue? Was it #16027? I did confirm that the current pre-release version of Edit: The stable version of |
Yes, 9b7ec5e specifically |
Syntax highlighting in macros like
println!
andformat_args!
is awesome! Unfortunately, it doesn't seem to work withtracing
macros as I would expect it to, since the expansion appears to useformat_args!
similarly to other cases. Example: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 useformat_args!
and the expansion contains this: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
The text was updated successfully, but these errors were encountered: