editor: Improve hover popover delay. (#1389)
This commit is contained in:
parent
e0c1f91ed4
commit
31db24b689
1 changed files with 7 additions and 3 deletions
|
|
@ -48,10 +48,14 @@ impl InputState {
|
|||
let task = provider.hover(&self.text, offset, window, cx);
|
||||
let mut symbol_range = self.text.word_range(offset).unwrap_or(offset..offset);
|
||||
let editor = cx.entity();
|
||||
let should_delay = self.hover_popover.is_none();
|
||||
self.lsp._hover_task = cx.spawn_in(window, async move |_, cx| {
|
||||
cx.background_executor()
|
||||
.timer(Duration::from_millis(150))
|
||||
.await;
|
||||
if should_delay {
|
||||
cx.background_executor()
|
||||
.timer(Duration::from_millis(150))
|
||||
.await;
|
||||
}
|
||||
|
||||
let result = task.await?;
|
||||
|
||||
_ = editor.update(cx, |editor, cx| match result {
|
||||
|
|
|
|||
Loading…
Reference in a new issue