-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Semantic highlighting for format macros #10394
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
Labels
A-macro
macro expansion
C-bug
Category: bug
S-actionable
Someone could pick this issue up and work on it right now
Comments
bors bot
added a commit
that referenced
this issue
Sep 30, 2021
10397: fix: fix format string highlighting for `panic!` and `assert!` r=jonas-schievink a=jonas-schievink part of #10394 bors r+ Co-authored-by: Jonas Schievink <[email protected]>
bors bot
added a commit
that referenced
this issue
Sep 30, 2021
10397: fix: fix format string highlighting for `panic!` and `assert!` r=jonas-schievink a=jonas-schievink part of #10394 bors r+ Co-authored-by: Jonas Schievink <[email protected]>
#10397 fixes |
which we should already handle, so there's another bug in there.
which is hard to handle correctly, since the actual format string passed to |
bors bot
added a commit
that referenced
this issue
Sep 30, 2021
10400: fix: fix format string highlighting for `todo!` and `unimplemented!` r=jonas-schievink a=jonas-schievink Part of #10394 These macros require us to see through the `const_format_args!` invocation the panic macros generate, for that we have to add it to our supported built-in macros. I've also made the macros in the test `#[macro_export]` (turns out they didn't all resolve correctly before this), which changes the output slightly. bors r+ Co-authored-by: Jonas Schievink <[email protected]>
bors bot
added a commit
that referenced
this issue
Sep 30, 2021
10400: fix: fix format string highlighting for `todo!` and `unimplemented!` r=jonas-schievink a=jonas-schievink Part of #10394 These macros require us to see through the `const_format_args!` invocation the panic macros generate, for that we have to add it to our supported built-in macros. I've also made the macros in the test `#[macro_export]` (turns out they didn't all resolve correctly before this), which changes the output slightly. bors r+ Co-authored-by: Jonas Schievink <[email protected]>
bors bot
added a commit
that referenced
this issue
Oct 1, 2021
10412: feat: highlight `asm!` as format string r=jonas-schievink a=jonas-schievink  part of #10394 bors r+ Co-authored-by: Jonas Schievink <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-macro
macro expansion
C-bug
Category: bug
S-actionable
Someone could pick this issue up and work on it right now
Uh oh!
There was an error while loading. Please reload this page.
The
{}
inprintln!("{}", 1)
is highlighted specially, which is a very nice feature. However, it only works for some of the format-like macros:asm!
assert!
assert_eq!
assert_ne!
debug_assert!
debug_assert_eq!
debug_assert_ne!
eprint!
eprintln!
format!
format_args!
format_args_nl!
panic!
*print!
println!
todo!
*unimplemented!
*unreachable!
write!
writeln!
Arguably, support for
asm
is more complicated, but it seems close enough toformat_args
style input in the first argument that I think that applying the usual syntax highlighting will work well enough. Here's a rust snippet containing all the macros for quick testing:Tested on rust-analyzer v0.2.760 on VSCode with
rustc 1.57.0-nightly (11491938f 2021-09-29)
. The macros marked with*
are recent regressions, which work on stable but not on the latest nightly, presumably due to a change in the implementation ofpanic!
relating to rust 2021.The text was updated successfully, but these errors were encountered: