diff --git a/helix-dap/src/client.rs b/helix-dap/src/client.rs index 90ddeb2f..ba13b96a 100644 --- a/helix-dap/src/client.rs +++ b/helix-dap/src/client.rs @@ -35,7 +35,6 @@ pub struct Client { pub thread_id: Option, /// Currently active frame for the current thread. pub active_frame: Option, - pub is_running: bool, // TODO: track is_running per thread } impl Client { @@ -83,7 +82,6 @@ impl Client { thread_states: HashMap::new(), thread_id: None, active_frame: None, - is_running: false, }; tokio::spawn(Self::recv(server_rx, client_rx)); diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 527d374f..d74f9198 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -323,8 +323,13 @@ impl Application { self.editor.set_status(format!("{} {}", prefix, output)); } Event::Initialized => { - self.editor - .set_status("Debugged application started".to_owned()); + // send existing breakpoints + // TODO: fetch breakpoints (in case we're attaching) + + if let Ok(_) = debugger.configuration_done().await { + self.editor + .set_status("Debugged application started".to_owned()); + }; // TODO: do we need to handle error? } ev => { log::warn!("Unhandled event {:?}", ev); diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 7b2fd295..3e740ead 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -310,7 +310,6 @@ impl Command { select_textobject_inner, "Select inside object", dap_launch, "Launch debug target", dap_toggle_breakpoint, "Toggle breakpoint", - dap_run, "Begin program execution", dap_continue, "Continue program execution", dap_pause, "Pause program execution", dap_step_in, "Step in", diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs index f40bdcbf..7618fca2 100644 --- a/helix-term/src/commands/dap.rs +++ b/helix-term/src/commands/dap.rs @@ -100,7 +100,7 @@ fn thread_picker(cx: &mut Context, callback_fn: impl Fn(&mut Editor, &dap::Threa let picker = Picker::new( true, threads, - |thread| thread.name.clone().into(), + |thread| thread.name.clone().into(), // TODO: include thread_states in the label move |editor, thread, _action| callback_fn(editor, thread), ); cx.push_layer(Box::new(picker)) @@ -300,25 +300,6 @@ pub fn dap_toggle_breakpoint(cx: &mut Context) { } } -pub fn dap_run(cx: &mut Context) { - let debugger = match &mut cx.editor.debugger { - Some(debugger) => debugger, - None => return, - }; - - if debugger.is_running { - cx.editor - .set_status("Debuggee is already running".to_owned()); - return; - } - let request = debugger.configuration_done(); - if let Err(e) = block_on(request) { - cx.editor.set_error(format!("Failed to run: {:?}", e)); - return; - } - debugger.is_running = true; -} - pub fn dap_continue(cx: &mut Context) { let debugger = match &mut cx.editor.debugger { Some(debugger) => debugger, @@ -340,10 +321,10 @@ pub fn dap_continue(cx: &mut Context) { pub fn dap_pause(cx: &mut Context) { thread_picker(cx, |editor, thread| { - let debugger = match &mut editor.debugger { - Some(debugger) => debugger, - None => return, - }; + let debugger = match &mut editor.debugger { + Some(debugger) => debugger, + None => return, + }; let request = debugger.pause(thread.id); // NOTE: we don't need to set active thread id here because DAP will emit a "stopped" event if let Err(e) = block_on(request) { diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs index 1b04b5cd..7710c321 100644 --- a/helix-term/src/keymap.rs +++ b/helix-term/src/keymap.rs @@ -490,7 +490,6 @@ impl Default for Keymaps { "d" => { "Debug" "l" => dap_launch, "b" => dap_toggle_breakpoint, - "r" => dap_run, "c" => dap_continue, "h" => dap_pause, "i" => dap_step_in,