From 89efb4f711d37ac59b4f5f985467647be76fb870 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Fri, 18 Nov 2022 12:27:46 -0600 Subject: lsp: Resolve completion item asynchronously on idle-timeout (#4781) d7d0d5ffb79b6f2e09c6ab8af6e112c41e6f73e8 resolves completion items on the idle-timeout event. The `Completion::resolve_completion_item` function blocks on the LSP request though, which blocks the compositor and in turn blocks the event loop. So until the language server returns the resolved completion item, Helix is unable to respond to keypresses or other LSP messages. This is typically ok since the resolution request is fast but for some language servers this can be problematic, and ideally we shouldn't be blocking like this anyways. When receiving a `completionItem/resolve` request, the Volar server sends a `workspace/configuration` request to Helix and blocks itself on the response, leading to a deadlock. Eventually the resolve request times out within Helix but Helix is locked up and unresponsive in that window. This change resolves the completion item without blocking the compositor.--- helix-lsp/src/client.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'helix-lsp') diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 50c4b87f..424cbabf 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -650,12 +650,11 @@ impl Client { self.call::(params) } - pub async fn resolve_completion_item( + pub fn resolve_completion_item( &self, completion_item: lsp::CompletionItem, - ) -> Result { - self.request::(completion_item) - .await + ) -> impl Future> { + self.call::(completion_item) } pub fn text_document_signature_help( -- cgit v1.2.3-70-g09d2