mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Render literal escaping errors in hovers
This commit is contained in:
parent
253929f6ae
commit
a39c0493a1
10 changed files with 71 additions and 82 deletions
|
@ -25,7 +25,7 @@ pub(super) fn highlight_escape_string<T: IsString>(
|
|||
}
|
||||
|
||||
pub(super) fn highlight_escape_char(stack: &mut Highlights, char: &Char, start: TextSize) {
|
||||
if char.value().is_none() {
|
||||
if char.value().is_err() {
|
||||
// We do not emit invalid escapes highlighting here. The lexer would likely be in a bad
|
||||
// state and this token contains junks, since `'` is not a reliable delimiter (consider
|
||||
// lifetimes). Nonetheless, parser errors should already be emitted.
|
||||
|
@ -48,7 +48,7 @@ pub(super) fn highlight_escape_char(stack: &mut Highlights, char: &Char, start:
|
|||
}
|
||||
|
||||
pub(super) fn highlight_escape_byte(stack: &mut Highlights, byte: &Byte, start: TextSize) {
|
||||
if byte.value().is_none() {
|
||||
if byte.value().is_err() {
|
||||
// See `highlight_escape_char` for why no error highlighting here.
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ pub(super) fn ra_fixture(
|
|||
if !active_parameter.ident().map_or(false, |name| name.text().starts_with("ra_fixture")) {
|
||||
return None;
|
||||
}
|
||||
let value = literal.value()?;
|
||||
let value = literal.value().ok()?;
|
||||
|
||||
if let Some(range) = literal.open_quote_text_range() {
|
||||
hl.add(HlRange { range, highlight: HlTag::StringLiteral.into(), binding_hash: None })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue