diff options
author | Blaž Hrastnik | 2022-02-17 03:22:48 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-02-18 05:37:59 +0000 |
commit | 7b1d682fe55cfa72c1ecf5a1763940cf105902e4 (patch) | |
tree | 3b32b7c97f362ab6ed87dac0ddf990042e791801 /helix-term/src/application.rs | |
parent | 4e1b3b12f3f5626f1ab371d99fecd23e2f5b8603 (diff) |
dap: fix runInTerminal with lldb-vscode
Diffstat (limited to 'helix-term/src/application.rs')
-rw-r--r-- | helix-term/src/application.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 49eb08d0..db289f57 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -479,10 +479,28 @@ impl Application { Payload::Response(_) => unreachable!(), Payload::Request(request) => match request.command.as_str() { RunInTerminal::COMMAND => { - let arguments: dap::requests::RunInTerminalArguments = + let mut arguments: dap::requests::RunInTerminalArguments = serde_json::from_value(request.arguments.unwrap_or_default()).unwrap(); // TODO: no unwrap + log::error!("run_in_terminal {:?}", arguments); + + // HAXX: lldb-vscode uses $CWD/lldb-vscode which is wrong + let program = arguments.args[0] + .strip_prefix( + std::env::current_dir() + .expect("Couldn't get current working directory") + .as_path() + .to_str() + .unwrap(), + ) + .and_then(|arg| arg.strip_prefix('/')) + .map(|arg| arg.to_owned()) + .unwrap_or_else(|| arguments.args[0].clone()); + arguments.args[0] = program; + + log::error!("{}", arguments.args.join(" ")); + // TODO: handle cwd let process = std::process::Command::new("tmux") .arg("split-window") |