mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-25 02:46:17 +04:00
don't automatically dismiss zero width diagnostics (#9280)
This commit is contained in:
parent
20b91fd99a
commit
4da6191a1c
@ -1222,18 +1222,23 @@ fn apply_impl(
|
|||||||
};
|
};
|
||||||
(&mut diagnostic.range.start, assoc)
|
(&mut diagnostic.range.start, assoc)
|
||||||
}));
|
}));
|
||||||
changes.update_positions(self.diagnostics.iter_mut().map(|diagnostic| {
|
changes.update_positions(self.diagnostics.iter_mut().filter_map(|diagnostic| {
|
||||||
|
if diagnostic.zero_width {
|
||||||
|
// for zero width diagnostics treat the diagnostic as a point
|
||||||
|
// rather than a range
|
||||||
|
return None;
|
||||||
|
}
|
||||||
let assoc = if diagnostic.ends_at_word {
|
let assoc = if diagnostic.ends_at_word {
|
||||||
Assoc::AfterWord
|
Assoc::AfterWord
|
||||||
} else {
|
} else {
|
||||||
Assoc::Before
|
Assoc::Before
|
||||||
};
|
};
|
||||||
(&mut diagnostic.range.end, assoc)
|
Some((&mut diagnostic.range.end, assoc))
|
||||||
}));
|
}));
|
||||||
self.diagnostics.retain_mut(|diagnostic| {
|
self.diagnostics.retain_mut(|diagnostic| {
|
||||||
if diagnostic.range.start > diagnostic.range.end
|
if diagnostic.zero_width {
|
||||||
|| (!diagnostic.zero_width && diagnostic.range.start == diagnostic.range.end)
|
diagnostic.range.end = diagnostic.range.start
|
||||||
{
|
} else if diagnostic.range.start >= diagnostic.range.end {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
diagnostic.line = self.text.char_to_line(diagnostic.range.start);
|
diagnostic.line = self.text.char_to_line(diagnostic.range.start);
|
||||||
|
Loading…
Reference in New Issue
Block a user