aboutsummaryrefslogtreecommitdiff
path: root/helix-lsp/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-lsp/src')
-rw-r--r--helix-lsp/src/client.rs14
-rw-r--r--helix-lsp/src/lib.rs7
2 files changed, 20 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)
+ }
}
diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs
index 15cae582..8fb321bc 100644
--- a/helix-lsp/src/lib.rs
+++ b/helix-lsp/src/lib.rs
@@ -203,6 +203,7 @@ pub mod util {
#[derive(Debug, PartialEq, Clone)]
pub enum MethodCall {
WorkDoneProgressCreate(lsp::WorkDoneProgressCreateParams),
+ ApplyWorkspaceEdit(lsp::ApplyWorkspaceEditParams),
}
impl MethodCall {
@@ -215,6 +216,12 @@ impl MethodCall {
.expect("Failed to parse WorkDoneCreate params");
Self::WorkDoneProgressCreate(params)
}
+ lsp::request::ApplyWorkspaceEdit::METHOD => {
+ let params: lsp::ApplyWorkspaceEditParams = params
+ .parse()
+ .expect("Failed to parse ApplyWorkspaceEdit params");
+ Self::ApplyWorkspaceEdit(params)
+ }
_ => {
log::warn!("unhandled lsp request: {}", method);
return None;