Compare commits

...

2 Commits

Author SHA1 Message Date
MrLego8_9
ec56c97b3a
Merge 68d07ea7cb into 35802cb025 2024-11-20 11:40:08 -06:00
Louis D
68d07ea7cb
feat: add support for lsp workspace command arguments in prompt 2024-11-16 01:43:24 +01:00

View File

@ -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<Value> = 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,
},
);