multi_buffer: Remap excerpt ids to latest excerpt in excerpt fetching (#44229)

Closes #ISSUE

Release Notes:

- N/A *or* Added/Fixed/Improved ...

Co-authored by: Cole Miller <cole@zed.dev>
This commit is contained in:
Lukas Wirth
2025-12-05 18:20:29 +00:00
committed by GitHub
parent d76dd86272
commit 37b0cdf94b
3 changed files with 16 additions and 7 deletions
+12 -4
View File
@@ -419,22 +419,30 @@ impl SelectionsCollection {
mutable_collection.disjoint.iter().for_each(|selection| {
assert!(
snapshot.can_resolve(&selection.start),
"disjoint selection start is not resolvable for the given snapshot:\n{selection:?}",
"disjoint selection start is not resolvable for the given snapshot:\n{selection:?}, {excerpt:?}",
excerpt = snapshot.buffer_for_excerpt(selection.start.excerpt_id).map(|snapshot| snapshot.remote_id()),
);
assert!(
snapshot.can_resolve(&selection.end),
"disjoint selection end is not resolvable for the given snapshot: {selection:?}",
"disjoint selection end is not resolvable for the given snapshot: {selection:?}, {excerpt:?}",
excerpt = snapshot.buffer_for_excerpt(selection.end.excerpt_id).map(|snapshot| snapshot.remote_id()),
);
});
if let Some(pending) = &mutable_collection.pending {
let selection = &pending.selection;
assert!(
snapshot.can_resolve(&selection.start),
"pending selection start is not resolvable for the given snapshot: {pending:?}",
"pending selection start is not resolvable for the given snapshot: {pending:?}, {excerpt:?}",
excerpt = snapshot
.buffer_for_excerpt(selection.start.excerpt_id)
.map(|snapshot| snapshot.remote_id()),
);
assert!(
snapshot.can_resolve(&selection.end),
"pending selection end is not resolvable for the given snapshot: {pending:?}",
"pending selection end is not resolvable for the given snapshot: {pending:?}, {excerpt:?}",
excerpt = snapshot
.buffer_for_excerpt(selection.end.excerpt_id)
.map(|snapshot| snapshot.remote_id()),
);
}
}