mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-19 01:50:32 +00:00
format string highlighting: handle hex + debug type specifier
This commit is contained in:
parent
e8c803937c
commit
a15dda48c6
3 changed files with 26 additions and 0 deletions
|
@ -331,10 +331,22 @@ pub trait HasFormatSpecifier: AstToken {
|
|||
}
|
||||
c if c == '_' || c.is_alphabetic() => {
|
||||
read_identifier(&mut chars, &mut callback);
|
||||
|
||||
if chars.peek().and_then(|next| next.1.as_ref().ok()).copied()
|
||||
== Some('?')
|
||||
{
|
||||
skip_char_and_emit(
|
||||
&mut chars,
|
||||
FormatSpecifier::QuestionMark,
|
||||
&mut callback,
|
||||
);
|
||||
}
|
||||
|
||||
// can be either width (indicated by dollar sign, or type in which case
|
||||
// the next sign has to be `}`)
|
||||
let next =
|
||||
chars.peek().and_then(|next| next.1.as_ref().ok()).copied();
|
||||
|
||||
match next {
|
||||
Some('$') => skip_char_and_emit(
|
||||
&mut chars,
|
||||
|
@ -417,6 +429,16 @@ pub trait HasFormatSpecifier: AstToken {
|
|||
}
|
||||
c if c == '_' || c.is_alphabetic() => {
|
||||
read_identifier(&mut chars, &mut callback);
|
||||
|
||||
if chars.peek().and_then(|next| next.1.as_ref().ok()).copied()
|
||||
== Some('?')
|
||||
{
|
||||
skip_char_and_emit(
|
||||
&mut chars,
|
||||
FormatSpecifier::QuestionMark,
|
||||
&mut callback,
|
||||
);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue