Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Query hints on every scroll
Kirill Bulatov708409e06d38
diff --git a/crates/editor/src/inlay_hint_cache.rs b/crates/editor/src/inlay_hint_cache.rsindex 44fbbf163d4..1dbef165fad 100644--- a/crates/editor/src/inlay_hint_cache.rs+++ b/crates/editor/src/inlay_hint_cache.rs@@ -24,6 +24,7 @@ pub struct InlayHintCache {allowed_hint_kinds: HashSet<Option<InlayHintKind>>,version: usize,enabled: bool,+ // TODO kb track them by excerpt rangeupdate_tasks: HashMap<ExcerptId, UpdateTask>,}@@ -100,6 +101,7 @@ impl InvalidationStrategy {}impl ExcerptQuery {+ // TODO kb query only visible + one visible below and abovefn hints_fetch_ranges(&self, buffer: &BufferSnapshot) -> HintFetchRanges {let visible_range =self.dimensions.excerpt_visible_range_start..self.dimensions.excerpt_visible_range_end;@@ -168,7 +170,6 @@ impl InlayHintCache {);if new_splice.is_some() {self.version += 1;- self.update_tasks.clear();self.allowed_hint_kinds = new_allowed_hint_kinds;}ControlFlow::Break(new_splice)@@ -464,6 +465,7 @@ fn spawn_new_update_tasks(cx,)};+ // TODO kb need to add to update tasks + ensure RefreshRequested cleans other rangesmatch editor.inlay_hint_cache.update_tasks.entry(excerpt_id) {hash_map::Entry::Occupied(mut o) => {let update_task = o.get_mut();diff --git a/crates/editor/src/scroll.rs b/crates/editor/src/scroll.rsindex d595337428d..1f3adaf477f 100644--- a/crates/editor/src/scroll.rs+++ b/crates/editor/src/scroll.rs@@ -13,7 +13,7 @@ use gpui::{};use language::{Bias, Point};use util::ResultExt;-use workspace::{item::Item, WorkspaceId};+use workspace::WorkspaceId;use crate::{display_map::{DisplaySnapshot, ToDisplayPoint},@@ -333,9 +333,7 @@ impl Editor {cx,);- if !self.is_singleton(cx) {- self.refresh_inlays(InlayRefreshReason::NewLinesShown, cx);- }+ self.refresh_inlays(InlayRefreshReason::NewLinesShown, cx);}pub fn scroll_position(&self, cx: &mut ViewContext<Self>) -> Vector2F {