@@ -2027,8 +2027,12 @@ mod cmd {
2027 args: &[&str],
2027 args: &[&str],
2028 _event: PromptEvent,
2028 _event: PromptEvent,
2029 ) -> anyhow::Result<()> {
2029 ) -> anyhow::Result<()> {
2030+ let mut args = args.to_owned();
2031+ let name = match args.len() {
2033+ _ => Some(args.remove(0)),
2030− dap_start_impl(&mut cx.editor, args.get(0).map(|name| name.to_string()));
2035+ dap_start_impl(&mut cx.editor, name, Some(args));
@@ -4402,7 +4406,7 @@ fn suspend(_cx: &mut Context) {
4405−fn dap_start_impl(editor: &mut Editor, name: Option<String>) {
4409+fn dap_start_impl(editor: &mut Editor, name: Option<&str>, params: Option<Vec<&str>>) {
4406 use helix_dap::Client;
4410 use helix_dap::Client;
4407 use helix_lsp::block_on;
4411 use helix_lsp::block_on;
4408 use serde_json::to_value;
4412 use serde_json::to_value;
@@ -4449,7 +4453,22 @@ fn dap_start_impl(editor: &mut Editor, name: Option<String>) {
4452− let args = to_value(start_config.args.clone()).unwrap();
4456+ let template = start_config.args.clone();
4457+ let mut args = HashMap::new();
4459+ if let Some(params) = params {
4460+ for (k, t) in template {
4462+ for (i, x) in params.iter().enumerate() {
4463+ // For param #0 replace {0} in args
4464+ value = value.replace(format!("{{{}}}", i).as_str(), x);
4467+ args.insert(k, value);
4471+ let args = to_value(args).unwrap();
4454 // TODO gracefully handle errors from debugger
4473 // TODO gracefully handle errors from debugger
4455 match &start_config.request[..] {
4474 match &start_config.request[..] {
@@ -4470,7 +4489,7 @@ fn dap_start_impl(editor: &mut Editor, name: Option<String>) {
4470fn dap_start(cx: &mut Context) {
4489fn dap_start(cx: &mut Context) {
4471 // TODO: check that first config does not have templates
4490 // TODO: check that first config does not have templates
4472 // which cannot be handled with a shortcut
4491 // which cannot be handled with a shortcut
4473− dap_start_impl(&mut cx.editor, None);
4492+ dap_start_impl(&mut cx.editor, None, None);
4476fn dap_toggle_breakpoint(cx: &mut Context) {
4495fn dap_toggle_breakpoint(cx: &mut Context) {