Fix more inlay_map corner cases and hangings
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
This commit is contained in:
co-authored by
Antonio Scandurra
parent
02e124cec4
commit
bec9c26fa2
@@ -253,7 +253,7 @@ impl InlayMap {
|
||||
pub fn sync(
|
||||
&mut self,
|
||||
suggestion_snapshot: SuggestionSnapshot,
|
||||
suggestion_edits: Vec<SuggestionEdit>,
|
||||
mut suggestion_edits: Vec<SuggestionEdit>,
|
||||
) -> (InlaySnapshot, Vec<InlayEdit>) {
|
||||
let mut snapshot = self.snapshot.lock();
|
||||
|
||||
@@ -262,6 +262,22 @@ impl InlayMap {
|
||||
new_snapshot.version += 1;
|
||||
}
|
||||
|
||||
if suggestion_snapshot
|
||||
.buffer_snapshot()
|
||||
.trailing_excerpt_update_count()
|
||||
!= snapshot
|
||||
.suggestion_snapshot
|
||||
.buffer_snapshot()
|
||||
.trailing_excerpt_update_count()
|
||||
{
|
||||
if suggestion_edits.is_empty() {
|
||||
suggestion_edits.push(Edit {
|
||||
old: snapshot.suggestion_snapshot.len()..snapshot.suggestion_snapshot.len(),
|
||||
new: suggestion_snapshot.len()..suggestion_snapshot.len(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
let mut inlay_edits = Patch::default();
|
||||
let mut new_transforms = SumTree::new();
|
||||
let mut cursor = snapshot
|
||||
@@ -393,7 +409,8 @@ impl InlayMap {
|
||||
to_remove: Vec<InlayId>,
|
||||
to_insert: Vec<(InlayId, InlayProperties<T>)>,
|
||||
) -> (InlaySnapshot, Vec<InlayEdit>) {
|
||||
let snapshot = self.snapshot.lock();
|
||||
let mut snapshot = self.snapshot.lock();
|
||||
snapshot.version += 1;
|
||||
|
||||
let mut edits = BTreeSet::new();
|
||||
for (id, properties) in to_insert {
|
||||
|
||||
Reference in New Issue
Block a user