diff options
author | Matouš Dzivjak | 2021-12-21 09:21:45 +0000 |
---|---|---|
committer | GitHub | 2021-12-21 09:21:45 +0000 |
commit | 75a8b789d20edf8b2e1d3da75497a9936953de68 (patch) | |
tree | ff103bc9d916223df04451fce7ba40117e9e11a5 /helix-lsp/src/client.rs | |
parent | 600ce70cf6d50ce37b96bfde90c6ade8db6cd8c3 (diff) |
LSP code action commands (#1304)
* feat(lsp): codeAction commands
* Don't block on command call
* Fix lifetime of command execution
* Fix lint issues
Diffstat (limited to 'helix-lsp/src/client.rs')
-rw-r--r-- | helix-lsp/src/client.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 271fd9d5..f1de8752 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -202,7 +202,7 @@ impl Client { Ok(result) => Output::Success(Success { jsonrpc: Some(Version::V2), id, - result, + result: serde_json::to_value(result)?, }), Err(error) => Output::Failure(Failure { jsonrpc: Some(Version::V2), @@ -800,4 +800,16 @@ impl Client { let response = self.request::<lsp::request::Rename>(params).await?; Ok(response.unwrap_or_default()) } + + pub fn command(&self, command: lsp::Command) -> impl Future<Output = Result<Value>> { + let params = lsp::ExecuteCommandParams { + command: command.command, + arguments: command.arguments.unwrap_or_default(), + work_done_progress_params: lsp::WorkDoneProgressParams { + work_done_token: None, + }, + }; + + self.call::<lsp::request::ExecuteCommand>(params) + } } |