mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 10:42:08 +00:00
Insert new hints into cache better
This commit is contained in:
parent
d6828583d8
commit
d59e91aff2
1 changed files with 11 additions and 9 deletions
|
@ -236,15 +236,18 @@ fn new_update_task(
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
match cached_excerpt_hints.hints.binary_search_by(|probe| {
|
cached_excerpt_hints.hints.push((
|
||||||
probe.0.cmp(&new_hint_position, &task_multi_buffer_snapshot)
|
new_hint_position,
|
||||||
}) {
|
new_inlay_id,
|
||||||
Ok(ix) | Err(ix) => cached_excerpt_hints.hints.insert(
|
new_hint,
|
||||||
ix,
|
));
|
||||||
(new_hint_position, new_inlay_id, new_hint),
|
|
||||||
),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cached_excerpt_hints.hints.sort_by(
|
||||||
|
|(position_a, _, _), (position_b, _, _)| {
|
||||||
|
position_a.cmp(position_b, &task_multi_buffer_snapshot)
|
||||||
|
},
|
||||||
|
);
|
||||||
editor.inlay_hint_cache.snapshot.hints.retain(
|
editor.inlay_hint_cache.snapshot.hints.retain(
|
||||||
|_, excerpt_hints| {
|
|_, excerpt_hints| {
|
||||||
excerpt_hints.hints.retain(|(_, hint_id, _)| {
|
excerpt_hints.hints.retain(|(_, hint_id, _)| {
|
||||||
|
@ -389,7 +392,6 @@ fn new_excerpt_hints_update_result(
|
||||||
let new_hint_anchor = state
|
let new_hint_anchor = state
|
||||||
.multi_buffer_snapshot
|
.multi_buffer_snapshot
|
||||||
.anchor_in_excerpt(excerpt_id, new_hint.position);
|
.anchor_in_excerpt(excerpt_id, new_hint.position);
|
||||||
// TODO kb use merge sort or something else better
|
|
||||||
let should_add_to_cache = match cached_excerpt_hints
|
let should_add_to_cache = match cached_excerpt_hints
|
||||||
.binary_search_by(|probe| probe.0.cmp(&new_hint_anchor, &state.multi_buffer_snapshot))
|
.binary_search_by(|probe| probe.0.cmp(&new_hint_anchor, &state.multi_buffer_snapshot))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue