@@ -19,7 +19,10 @@ pub fn dap_pos_to_pos(doc: &helix_core::Rope, line: usize, column: usize) -> Opt
21pub fn resume_application(debugger: &mut Client) {
21pub fn resume_application(debugger: &mut Client) {
22− debugger.is_running = true; // TODO: set state running for debugger.thread_id
22+ if let Some(thread_id) = debugger.thread_id {
23+ debugger.thread_states.insert(thread_id, "running".to_string());
24+ debugger.stack_frames.remove(&thread_id);
23 debugger.active_frame = None;
26 debugger.active_frame = None;
24 debugger.thread_id = None;
27 debugger.thread_id = None;
@@ -302,7 +305,6 @@ pub fn dap_continue(cx: &mut Context) {
304 resume_application(debugger);
307 resume_application(debugger);
305− debugger.stack_frames.remove(&thread_id);
307 cx.editor
309 cx.editor
308 .set_error("Currently active thread is not stopped. Switch the thread.".into());
310 .set_error("Currently active thread is not stopped. Switch the thread.".into());
@@ -315,6 +317,8 @@ pub fn dap_pause(cx: &mut Context) {
315 None => return,
317 None => return,
320+ // TODO: this should instead open a picker to pause a selected thread
318 if !debugger.is_running {
322 if !debugger.is_running {
319 cx.editor.set_status("Debuggee is not running".to_owned());
323 cx.editor.set_status("Debuggee is not running".to_owned());
@@ -340,7 +344,6 @@ pub fn dap_step_in(cx: &mut Context) {
342 resume_application(debugger);
346 resume_application(debugger);
343− debugger.stack_frames.remove(&thread_id);
345 cx.editor
348 cx.editor
346 .set_error("Currently active thread is not stopped. Switch the thread.".into());
349 .set_error("Currently active thread is not stopped. Switch the thread.".into());
@@ -360,7 +363,6 @@ pub fn dap_step_out(cx: &mut Context) {
362 resume_application(debugger);
365 resume_application(debugger);
363− debugger.stack_frames.remove(&thread_id);
365 cx.editor
367 cx.editor
366 .set_error("Currently active thread is not stopped. Switch the thread.".into());
368 .set_error("Currently active thread is not stopped. Switch the thread.".into());
@@ -380,7 +382,6 @@ pub fn dap_next(cx: &mut Context) {
382 resume_application(debugger);
384 resume_application(debugger);
383− debugger.stack_frames.remove(&thread_id);
385 cx.editor
386 cx.editor
386 .set_error("Currently active thread is not stopped. Switch the thread.".into());
387 .set_error("Currently active thread is not stopped. Switch the thread.".into());
@@ -393,7 +394,7 @@ pub fn dap_variables(cx: &mut Context) {
393 None => return,
394 None => return,
396− if debugger.is_running {
397+ if debugger.thread_id.is_none() {
397 cx.editor
398 cx.editor
398 .set_status("Cannot access variables while target is running".to_owned());
399 .set_status("Cannot access variables while target is running".to_owned());