diff options
author | Blaž Hrastnik | 2021-12-03 02:59:44 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-12-03 02:59:44 +0000 |
commit | 2dbf966293c7a92bd5eb6062c7033a20a207609f (patch) | |
tree | f0cbf36d0e69085ad0be083406d4ff0f0fca7c80 /helix-term/src/commands | |
parent | 0d73a4d23abf7b14321ec4db39a272372f923ad3 (diff) |
dap: Start working on runInTerminal support
Diffstat (limited to 'helix-term/src/commands')
-rw-r--r-- | helix-term/src/commands/dap.rs | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs index b44be16c..f2be3a6c 100644 --- a/helix-term/src/commands/dap.rs +++ b/helix-term/src/commands/dap.rs @@ -251,29 +251,40 @@ pub fn dap_start_impl( // For param #0 replace {0} in args let pattern = format!("{{{}}}", i); value = match value { + // TODO: just use toml::Value -> json::Value DebugArgumentValue::String(v) => { DebugArgumentValue::String(v.replace(&pattern, ¶m)) } DebugArgumentValue::Array(arr) => DebugArgumentValue::Array( arr.iter().map(|v| v.replace(&pattern, ¶m)).collect(), ), + DebugArgumentValue::Boolean(_) => value, }; } - if let DebugArgumentValue::String(string) = value { - if let Ok(integer) = string.parse::<usize>() { - args.insert(k, to_value(integer).unwrap()); - } else { - args.insert(k, to_value(string).unwrap()); + match value { + DebugArgumentValue::String(string) => { + if let Ok(integer) = string.parse::<usize>() { + args.insert(k, to_value(integer).unwrap()); + } else { + args.insert(k, to_value(string).unwrap()); + } + } + DebugArgumentValue::Array(arr) => { + args.insert(k, to_value(arr).unwrap()); + } + DebugArgumentValue::Boolean(bool) => { + args.insert(k, to_value(bool).unwrap()); } - } else if let DebugArgumentValue::Array(arr) = value { - args.insert(k, to_value(arr).unwrap()); } } } let args = to_value(args).unwrap(); + // problem: this blocks for too long while we get back the startInTerminal REQ + + log::error!("pre start"); let result = match &template.request[..] { "launch" => block_on(debugger.launch(args)), "attach" => block_on(debugger.attach(args)), @@ -282,6 +293,7 @@ pub fn dap_start_impl( return; } }; + log::error!("post start"); if let Err(e) = result { let msg = format!("Failed {} target: {}", template.request, e); editor.set_error(msg); |