Properly invalidate the hint cache

This commit is contained in:
Kirill Bulatov 2023-08-25 17:33:17 +03:00
parent 205e101dd0
commit 44c340b5f2

View File

@ -785,6 +785,7 @@ async fn fetch_and_update_hints(
editor, editor,
new_update, new_update,
query, query,
invalidate,
buffer_snapshot, buffer_snapshot,
multi_buffer_snapshot, multi_buffer_snapshot,
cx, cx,
@ -893,6 +894,7 @@ fn apply_hint_update(
editor: &mut Editor, editor: &mut Editor,
new_update: ExcerptHintsUpdate, new_update: ExcerptHintsUpdate,
query: ExcerptQuery, query: ExcerptQuery,
invalidate: bool,
buffer_snapshot: BufferSnapshot, buffer_snapshot: BufferSnapshot,
multi_buffer_snapshot: MultiBufferSnapshot, multi_buffer_snapshot: MultiBufferSnapshot,
cx: &mut ViewContext<'_, '_, Editor>, cx: &mut ViewContext<'_, '_, Editor>,
@ -970,7 +972,7 @@ fn apply_hint_update(
cached_excerpt_hints.buffer_version = buffer_snapshot.version().clone(); cached_excerpt_hints.buffer_version = buffer_snapshot.version().clone();
drop(cached_excerpt_hints); drop(cached_excerpt_hints);
if query.invalidate.should_invalidate() { if invalidate {
let mut outdated_excerpt_caches = HashSet::default(); let mut outdated_excerpt_caches = HashSet::default();
for (excerpt_id, excerpt_hints) in &editor.inlay_hint_cache().hints { for (excerpt_id, excerpt_hints) in &editor.inlay_hint_cache().hints {
let excerpt_hints = excerpt_hints.read(); let excerpt_hints = excerpt_hints.read();