From 08cf199b39e0b73bd38c46d7bfa812ba985aabb4 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Mon, 13 Oct 2025 10:40:09 +0800 Subject: [PATCH] editor: Add delay to trigger hover popover. (#1361) --- crates/ui/src/input/lsp/document_colors.rs | 1 + crates/ui/src/input/lsp/hover.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/crates/ui/src/input/lsp/document_colors.rs b/crates/ui/src/input/lsp/document_colors.rs index f5fb21b5..2b473b82 100644 --- a/crates/ui/src/input/lsp/document_colors.rs +++ b/crates/ui/src/input/lsp/document_colors.rs @@ -46,6 +46,7 @@ impl Lsp { }) .collect() } + pub(crate) fn update_document_colors( &mut self, text: &Rope, diff --git a/crates/ui/src/input/lsp/hover.rs b/crates/ui/src/input/lsp/hover.rs index 992f8210..a369fe43 100644 --- a/crates/ui/src/input/lsp/hover.rs +++ b/crates/ui/src/input/lsp/hover.rs @@ -1,3 +1,5 @@ +use std::time::Duration; + use anyhow::Result; use gpui::{App, Context, Task, Window}; use ropey::Rope; @@ -47,6 +49,9 @@ impl InputState { let mut symbol_range = self.text.word_range(offset).unwrap_or(offset..offset); let editor = cx.entity(); self.lsp._hover_task = cx.spawn_in(window, async move |_, cx| { + cx.background_executor() + .timer(Duration::from_millis(150)) + .await; let result = task.await?; _ = editor.update(cx, |editor, cx| match result {