|
|
|
@ -320,15 +320,15 @@ impl Application {
|
|
|
|
|
|
|
|
|
|
pub async fn handle_debugger_message(&mut self, payload: helix_dap::Payload) {
|
|
|
|
|
use crate::commands::dap::{breakpoints_changed, resume_application, select_thread_id};
|
|
|
|
|
use dap::requests::RunInTerminal;
|
|
|
|
|
use helix_dap::{events, Event};
|
|
|
|
|
|
|
|
|
|
match payload {
|
|
|
|
|
Payload::Event(ev) => {
|
|
|
|
|
let debugger = match self.editor.debugger.as_mut() {
|
|
|
|
|
Some(debugger) => debugger,
|
|
|
|
|
None => return,
|
|
|
|
|
};
|
|
|
|
|
match ev {
|
|
|
|
|
match payload {
|
|
|
|
|
Payload::Event(ev) => match ev {
|
|
|
|
|
Event::Stopped(events::Stopped {
|
|
|
|
|
thread_id,
|
|
|
|
|
description,
|
|
|
|
@ -465,16 +465,32 @@ impl Application {
|
|
|
|
|
log::warn!("Unhandled event {:?}", ev);
|
|
|
|
|
return; // return early to skip render
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
Payload::Response(_) => unreachable!(),
|
|
|
|
|
Payload::Request(request) => match request.command.as_str() {
|
|
|
|
|
dap::requests::RunInTerminal::COMMAND => {
|
|
|
|
|
RunInTerminal::COMMAND => {
|
|
|
|
|
let arguments: dap::requests::RunInTerminalArguments =
|
|
|
|
|
serde_json::from_value(request.arguments.unwrap_or_default()).unwrap();
|
|
|
|
|
// TODO: no unwrap
|
|
|
|
|
|
|
|
|
|
// TODO: dap reply
|
|
|
|
|
// TODO: handle cwd
|
|
|
|
|
let process = std::process::Command::new("tmux")
|
|
|
|
|
.arg("split-window")
|
|
|
|
|
.arg(arguments.args.join(" ")) // TODO: first arg is wrong, it uses current dir
|
|
|
|
|
.spawn()
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
|
|
|
|
let _ = debugger
|
|
|
|
|
.reply(
|
|
|
|
|
request.seq,
|
|
|
|
|
dap::requests::RunInTerminal::COMMAND,
|
|
|
|
|
serde_json::to_value(dap::requests::RunInTerminalResponse {
|
|
|
|
|
process_id: Some(process.id()),
|
|
|
|
|
shell_process_id: None,
|
|
|
|
|
})
|
|
|
|
|
.map_err(|e| e.into()),
|
|
|
|
|
)
|
|
|
|
|
.await;
|
|
|
|
|
}
|
|
|
|
|
_ => log::error!("DAP reverse request not implemented: {:?}", request),
|
|
|
|
|
},
|
|
|
|
|