mirror of
https://github.com/ilyakooo0/helix.git
synced 2024-11-28 21:20:23 +03:00
Re-sort diagnostics after transaction transform (#3895)
Applying document-change transactions to diagnostic ranges is not stable with respect to the ordering of diagnostics. This can cause diagnostics to become temporarily unordered with some edits to a document, which can eventually break some invariants/assumptions in syntax::merge. With this change, Document::diagnostics are always sorted.
This commit is contained in:
parent
947ff63e6d
commit
8988c1ecc7
@ -788,6 +788,8 @@ impl Document {
|
||||
diagnostic.range.end = changes.map_pos(diagnostic.range.end, Assoc::After);
|
||||
diagnostic.line = self.text.char_to_line(diagnostic.range.start);
|
||||
}
|
||||
self.diagnostics
|
||||
.sort_unstable_by_key(|diagnostic| diagnostic.range);
|
||||
|
||||
// emit lsp notification
|
||||
if let Some(language_server) = self.language_server() {
|
||||
|
Loading…
Reference in New Issue
Block a user