diff options
author | Michael Davis | 2024-02-19 15:07:03 +0000 |
---|---|---|
committer | Skyler Hawthorne | 2024-02-23 03:37:23 +0000 |
commit | b7b6f300841bb61d8833fee1c58d0e3670849b61 (patch) | |
tree | 08899b3a31ccd640ad7775badb702a2b28926977 /helix-lsp | |
parent | 98ebeeebd8c7462409f82d34ff4ac0a7ae9116c7 (diff) |
Use a hook for resolving completion items
Previously we used the IdleTimeout event to trigger LSP
`completion/resolveItem` requests. We can now refactor this to use an
event system hook instead and lower the timeout.
Diffstat (limited to 'helix-lsp')
-rw-r--r-- | helix-lsp/src/client.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 0d3a2a56..8d03d799 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -1017,7 +1017,7 @@ impl Client { pub fn resolve_completion_item( &self, completion_item: lsp::CompletionItem, - ) -> Option<impl Future<Output = Result<Value>>> { + ) -> Option<impl Future<Output = Result<lsp::CompletionItem>>> { let capabilities = self.capabilities.get().unwrap(); // Return early if the server does not support resolving completion items. @@ -1029,7 +1029,8 @@ impl Client { _ => return None, } - Some(self.call::<lsp::request::ResolveCompletionItem>(completion_item)) + let res = self.call::<lsp::request::ResolveCompletionItem>(completion_item); + Some(async move { Ok(serde_json::from_value(res.await?)?) }) } pub fn resolve_code_action( |