Move away heavy inlay computations into background tasks

This commit is contained in:
Kirill Bulatov 2023-06-21 22:17:47 +03:00
parent 31f0f9f7b1
commit 7fddc223cd
4 changed files with 395 additions and 825 deletions

View file

@ -176,7 +176,7 @@ impl ScrollManager {
autoscroll: bool,
workspace_id: Option<i64>,
cx: &mut ViewContext<Editor>,
) -> ScrollAnchor {
) {
let (new_anchor, top_row) = if scroll_position.y() <= 0. {
(
ScrollAnchor {
@ -205,7 +205,6 @@ impl ScrollManager {
};
self.set_anchor(new_anchor, top_row, local, autoscroll, workspace_id, cx);
new_anchor
}
fn set_anchor(
@ -313,7 +312,7 @@ impl Editor {
hide_hover(self, cx);
let workspace_id = self.workspace.as_ref().map(|workspace| workspace.1);
let scroll_anchor = self.scroll_manager.set_scroll_position(
self.scroll_manager.set_scroll_position(
scroll_position,
&map,
local,
@ -323,7 +322,7 @@ impl Editor {
);
if !self.is_singleton(cx) {
self.refresh_inlays(crate::InlayRefreshReason::Scroll(scroll_anchor), cx);
self.refresh_inlays(crate::InlayRefreshReason::Scroll, cx);
}
}