From 68d07ea7cb9c567e21a7955b1702ac62baf6087f Mon Sep 17 00:00:00 2001 From: Louis D Date: Sat, 16 Nov 2024 01:43:24 +0100 Subject: [PATCH] feat: add support for lsp workspace command arguments in prompt --- helix-term/src/commands/typed.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 68ba9bab5..6353d1928 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1426,19 +1426,28 @@ fn lsp_workspace_command( }; cx.jobs.callback(callback); } else { - let command = args.join(" "); + let command = args.first().unwrap().to_string(); + let matches: Vec<_> = ls_id_commands .filter(|(_ls_id, c)| *c == &command) .collect(); match matches.as_slice() { [(ls_id, _command)] => { + let lsp_command_args: Vec = args[1..] + .iter() + .map(|s| Value::String(s.to_string())) + .collect(); execute_lsp_command( cx.editor, *ls_id, helix_lsp::lsp::Command { title: command.clone(), - arguments: None, + arguments: if lsp_command_args.is_empty() { + None + } else { + Some(lsp_command_args) + }, command, }, );