Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Empty both hint cache storages correctly

Kirill Bulatov8c1df5afa2ed
diff --git a/crates/editor/src/inlay_hint_cache.rs b/crates/editor/src/inlay_hint_cache.rs
index eceae96856f..8aa7a1e40ed 100644
--- a/crates/editor/src/inlay_hint_cache.rs
+++ b/crates/editor/src/inlay_hint_cache.rs
@@ -986,10 +986,7 @@ fn calculate_hint_updates(
match cached_excerpt_hints
.ordered_hints
.binary_search_by(|probe| {
- cached_excerpt_hints
- .hints_by_id
- .get(probe)
- .unwrap()
+ cached_excerpt_hints.hints_by_id[probe]
.position
.cmp(&new_hint.position, buffer_snapshot)
}) {
@@ -1101,6 +1098,9 @@ fn apply_hint_update(
cached_excerpt_hints
.ordered_hints
.retain(|hint_id| !new_update.remove_from_cache.contains(hint_id));
+ cached_excerpt_hints
+ .hints_by_id
+ .retain(|hint_id, _| !new_update.remove_from_cache.contains(hint_id));
let mut splice = InlaySplice {
to_remove: new_update.remove_from_visible,
to_insert: Vec::new(),
@@ -3327,8 +3327,7 @@ all hints should be invalidated and requeried for all of its visible excerpts"
for (_, excerpt_hints) in &editor.inlay_hint_cache().hints {
let excerpt_hints = excerpt_hints.read();
for id in &excerpt_hints.ordered_hints {
- let inlay = excerpt_hints.hints_by_id.get(id).unwrap();
- labels.push(inlay.text());
+ labels.push(excerpt_hints.hints_by_id[id].text());
}
}