Ensure start endpoints always come before end endpoints

Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Antonio Scandurra 2021-10-28 18:26:32 +02:00
parent 50afb2d65f
commit d12387b753

View file

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