diagnostics: Keep diagnostic excerpt ranges properly ordered (#42298)

Fixes ZED-2CQ

We were doing the binary search by buffer points, but due to await
points within this function we could end up mixing points of differing
buffer versions.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Lukas Wirth
2025-11-09 10:55:56 +00:00
committed by GitHub
parent 81d38d9872
commit b7d4d1791a
6 changed files with 103 additions and 70 deletions
+2 -2
View File
@@ -1148,9 +1148,9 @@ impl MultiBuffer {
let mut counts: Vec<usize> = Vec::new();
for range in expanded_ranges {
if let Some(last_range) = merged_ranges.last_mut() {
debug_assert!(
assert!(
last_range.context.start <= range.context.start,
"Last range: {last_range:?} Range: {range:?}"
"ranges must be sorted: {last_range:?} <= {range:?}"
);
if last_range.context.end >= range.context.start
|| last_range.context.end.row + 1 == range.context.start.row