editor: Add delay to trigger hover popover. (#1361)
This commit is contained in:
parent
8a63fd67ab
commit
08cf199b39
2 changed files with 6 additions and 0 deletions
|
|
@ -46,6 +46,7 @@ impl Lsp {
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn update_document_colors(
|
pub(crate) fn update_document_colors(
|
||||||
&mut self,
|
&mut self,
|
||||||
text: &Rope,
|
text: &Rope,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use gpui::{App, Context, Task, Window};
|
use gpui::{App, Context, Task, Window};
|
||||||
use ropey::Rope;
|
use ropey::Rope;
|
||||||
|
|
@ -47,6 +49,9 @@ impl InputState {
|
||||||
let mut symbol_range = self.text.word_range(offset).unwrap_or(offset..offset);
|
let mut symbol_range = self.text.word_range(offset).unwrap_or(offset..offset);
|
||||||
let editor = cx.entity();
|
let editor = cx.entity();
|
||||||
self.lsp._hover_task = cx.spawn_in(window, async move |_, cx| {
|
self.lsp._hover_task = cx.spawn_in(window, async move |_, cx| {
|
||||||
|
cx.background_executor()
|
||||||
|
.timer(Duration::from_millis(150))
|
||||||
|
.await;
|
||||||
let result = task.await?;
|
let result = task.await?;
|
||||||
|
|
||||||
_ = editor.update(cx, |editor, cx| match result {
|
_ = editor.update(cx, |editor, cx| match result {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue