Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-view/src/handlers/lsp.rs')
-rw-r--r--helix-view/src/handlers/lsp.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/helix-view/src/handlers/lsp.rs b/helix-view/src/handlers/lsp.rs
index dc2e1755..bf541929 100644
--- a/helix-view/src/handlers/lsp.rs
+++ b/helix-view/src/handlers/lsp.rs
@@ -361,4 +361,22 @@ impl Editor {
helix_event::dispatch(DiagnosticsDidChange { editor: self, doc });
}
}
+
+ pub fn execute_lsp_command(&mut self, command: lsp::Command, server_id: LanguageServerId) {
+ // the command is executed on the server and communicated back
+ // to the client asynchronously using workspace edits
+ let Some(future) = self
+ .language_server_by_id(server_id)
+ .and_then(|server| server.command(command))
+ else {
+ self.set_error("Language server does not support executing commands");
+ return;
+ };
+
+ tokio::spawn(async move {
+ if let Err(err) = future.await {
+ log::error!("Error executing LSP command: {err}");
+ }
+ });
+ }
}