aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authorPascal Kuthe2024-01-09 00:54:55 +0000
committerGitHub2024-01-09 00:54:55 +0000
commit4da6191a1c821eaff580392b41a2eb7245a475b7 (patch)
treed3beb25ec3518b18d221639ac8a273531a312ca2 /helix-view
parent20b91fd99a91621d6153cd00f5527b7571290df4 (diff)
don't automatically dismiss zero width diagnostics (#9280)
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/document.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index af950a3f..51668ab1 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -1222,18 +1222,23 @@ impl Document {
};
(&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 {
Assoc::AfterWord
} else {
Assoc::Before
};
- (&mut diagnostic.range.end, assoc)
+ Some((&mut diagnostic.range.end, assoc))
}));
self.diagnostics.retain_mut(|diagnostic| {
- if diagnostic.range.start > diagnostic.range.end
- || (!diagnostic.zero_width && diagnostic.range.start == diagnostic.range.end)
- {
+ if diagnostic.zero_width {
+ diagnostic.range.end = diagnostic.range.start
+ } else if diagnostic.range.start >= diagnostic.range.end {
return false;
}
diagnostic.line = self.text.char_to_line(diagnostic.range.start);