Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/src/commands/lsp.rs')
| -rw-r--r-- | helix-term/src/commands/lsp.rs | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index c5442924..f9603166 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -772,7 +772,7 @@ pub fn code_action(cx: &mut Context) { match &action.lsp_item { lsp::CodeActionOrCommand::Command(command) => { log::debug!("code action command: {:?}", command); - execute_lsp_command(editor, action.language_server_id, command.clone()); + editor.execute_lsp_command(command.clone(), action.language_server_id); } lsp::CodeActionOrCommand::CodeAction(code_action) => { log::debug!("code action: {:?}", code_action); @@ -801,7 +801,7 @@ pub fn code_action(cx: &mut Context) { // if code action provides both edit and command first the edit // should be applied and then the command if let Some(command) = &code_action.command { - execute_lsp_command(editor, action.language_server_id, command.clone()); + editor.execute_lsp_command(command.clone(), action.language_server_id); } } } @@ -817,33 +817,6 @@ pub fn code_action(cx: &mut Context) { }); } -pub fn execute_lsp_command( - editor: &mut Editor, - language_server_id: LanguageServerId, - cmd: lsp::Command, -) { - // the command is executed on the server and communicated back - // to the client asynchronously using workspace edits - let future = match editor - .language_server_by_id(language_server_id) - .and_then(|language_server| language_server.command(cmd)) - { - Some(future) => future, - None => { - editor.set_error("Language server does not support executing commands"); - return; - } - }; - - tokio::spawn(async move { - let res = future.await; - - if let Err(e) = res { - log::error!("execute LSP command: {}", e); - } - }); -} - #[derive(Debug)] pub struct ApplyEditError { pub kind: ApplyEditErrorKind, |