diff options
author | Michael Davis | 2022-11-18 18:27:46 +0000 |
---|---|---|
committer | GitHub | 2022-11-18 18:27:46 +0000 |
commit | 89efb4f711d37ac59b4f5f985467647be76fb870 (patch) | |
tree | 70fb86125d9ddf601fd9de16cdf88c51b2284f77 /helix-lsp/src/client.rs | |
parent | eada6d534e022b66e1c1d631670dc1ccbe922b9e (diff) |
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.
Diffstat (limited to 'helix-lsp/src/client.rs')
-rw-r--r-- | helix-lsp/src/client.rs | 7 |
1 files changed, 3 insertions, 4 deletions
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::<lsp::request::Completion>(params) } - pub async fn resolve_completion_item( + pub fn resolve_completion_item( &self, completion_item: lsp::CompletionItem, - ) -> Result<lsp::CompletionItem> { - self.request::<lsp::request::ResolveCompletionItem>(completion_item) - .await + ) -> impl Future<Output = Result<Value>> { + self.call::<lsp::request::ResolveCompletionItem>(completion_item) } pub fn text_document_signature_help( |