From d12387b7539c0d47adbca3927ae9ed6b3fb1aef7 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Oct 2021 18:26:32 +0200 Subject: [PATCH] Ensure start endpoints always come before end endpoints Co-Authored-By: Max Brunsfeld --- crates/language/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/language/src/lib.rs b/crates/language/src/lib.rs index 5e5a27e35a7bbc476f681a7b68875b7d29b9c71b..351d6840b327a3df77bce95a363530dec4ab29d9 100644 --- a/crates/language/src/lib.rs +++ b/crates/language/src/lib.rs @@ -1553,7 +1553,7 @@ impl Snapshot { severity: *severity, }); } - diagnostic_endpoints.sort_unstable_by_key(|endpoint| endpoint.offset); + diagnostic_endpoints.sort_unstable_by_key(|endpoint| (endpoint.offset, !endpoint.is_start)); let diagnostic_endpoints = diagnostic_endpoints.into_iter().peekable(); let chunks = self.text.as_rope().chunks_in_range(range.clone());