Ensure start endpoints always come before end endpoints

Antonio Scandurra and Max Brunsfeld created

Co-Authored-By: Max Brunsfeld <max@zed.dev>

Change summary

crates/language/src/lib.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Detailed changes

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());