Query hints on every scroll
This commit is contained in:
parent
5d2750e0d4
commit
708409e06d
2 changed files with 5 additions and 5 deletions
|
@ -24,6 +24,7 @@ pub struct InlayHintCache {
|
||||||
allowed_hint_kinds: HashSet<Option<InlayHintKind>>,
|
allowed_hint_kinds: HashSet<Option<InlayHintKind>>,
|
||||||
version: usize,
|
version: usize,
|
||||||
enabled: bool,
|
enabled: bool,
|
||||||
|
// TODO kb track them by excerpt range
|
||||||
update_tasks: HashMap<ExcerptId, UpdateTask>,
|
update_tasks: HashMap<ExcerptId, UpdateTask>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,6 +101,7 @@ impl InvalidationStrategy {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ExcerptQuery {
|
impl ExcerptQuery {
|
||||||
|
// TODO kb query only visible + one visible below and above
|
||||||
fn hints_fetch_ranges(&self, buffer: &BufferSnapshot) -> HintFetchRanges {
|
fn hints_fetch_ranges(&self, buffer: &BufferSnapshot) -> HintFetchRanges {
|
||||||
let visible_range =
|
let visible_range =
|
||||||
self.dimensions.excerpt_visible_range_start..self.dimensions.excerpt_visible_range_end;
|
self.dimensions.excerpt_visible_range_start..self.dimensions.excerpt_visible_range_end;
|
||||||
|
@ -168,7 +170,6 @@ impl InlayHintCache {
|
||||||
);
|
);
|
||||||
if new_splice.is_some() {
|
if new_splice.is_some() {
|
||||||
self.version += 1;
|
self.version += 1;
|
||||||
self.update_tasks.clear();
|
|
||||||
self.allowed_hint_kinds = new_allowed_hint_kinds;
|
self.allowed_hint_kinds = new_allowed_hint_kinds;
|
||||||
}
|
}
|
||||||
ControlFlow::Break(new_splice)
|
ControlFlow::Break(new_splice)
|
||||||
|
@ -464,6 +465,7 @@ fn spawn_new_update_tasks(
|
||||||
cx,
|
cx,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
// TODO kb need to add to update tasks + ensure RefreshRequested cleans other ranges
|
||||||
match editor.inlay_hint_cache.update_tasks.entry(excerpt_id) {
|
match editor.inlay_hint_cache.update_tasks.entry(excerpt_id) {
|
||||||
hash_map::Entry::Occupied(mut o) => {
|
hash_map::Entry::Occupied(mut o) => {
|
||||||
let update_task = o.get_mut();
|
let update_task = o.get_mut();
|
||||||
|
|
|
@ -13,7 +13,7 @@ use gpui::{
|
||||||
};
|
};
|
||||||
use language::{Bias, Point};
|
use language::{Bias, Point};
|
||||||
use util::ResultExt;
|
use util::ResultExt;
|
||||||
use workspace::{item::Item, WorkspaceId};
|
use workspace::WorkspaceId;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
display_map::{DisplaySnapshot, ToDisplayPoint},
|
display_map::{DisplaySnapshot, ToDisplayPoint},
|
||||||
|
@ -333,9 +333,7 @@ impl Editor {
|
||||||
cx,
|
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 {
|
pub fn scroll_position(&self, cx: &mut ViewContext<Self>) -> Vector2F {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue