@@ -19,7 +19,10 @@ pub fn dap_pos_to_pos(doc: &helix_core::Rope, line: usize, column: usize) -> Opt
1919}
2020
2121pub 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);
25+ }
2326 debugger.active_frame = None;
2427 debugger.thread_id = None;
2528}
@@ -302,7 +305,6 @@ pub fn dap_continue(cx: &mut Context) {
302305 return;
303306 }
304307 resume_application(debugger);
305− debugger.stack_frames.remove(&thread_id);
306308 } else {
307309 cx.editor
308310 .set_error("Currently active thread is not stopped. Switch the thread.".into());
@@ -315,6 +317,8 @@ pub fn dap_pause(cx: &mut Context) {
315317 None => return,
316318 };
317319
320+ // TODO: this should instead open a picker to pause a selected thread
321+
318322 if !debugger.is_running {
319323 cx.editor.set_status("Debuggee is not running".to_owned());
320324 return;
@@ -340,7 +344,6 @@ pub fn dap_step_in(cx: &mut Context) {
340344 return;
341345 }
342346 resume_application(debugger);
343− debugger.stack_frames.remove(&thread_id);
344347 } else {
345348 cx.editor
346349 .set_error("Currently active thread is not stopped. Switch the thread.".into());
@@ -360,7 +363,6 @@ pub fn dap_step_out(cx: &mut Context) {
360363 return;
361364 }
362365 resume_application(debugger);
363− debugger.stack_frames.remove(&thread_id);
364366 } else {
365367 cx.editor
366368 .set_error("Currently active thread is not stopped. Switch the thread.".into());
@@ -380,7 +382,6 @@ pub fn dap_next(cx: &mut Context) {
380382 return;
381383 }
382384 resume_application(debugger);
383− debugger.stack_frames.remove(&thread_id);
384385 } else {
385386 cx.editor
386387 .set_error("Currently active thread is not stopped. Switch the thread.".into());
@@ -393,7 +394,7 @@ pub fn dap_variables(cx: &mut Context) {
393394 None => return,
394395 };
395396
396− if debugger.is_running {
397+ if debugger.thread_id.is_none() {
397398 cx.editor
398399 .set_status("Cannot access variables while target is running".to_owned());
399400 return;