diff options
author | Blaž Hrastnik | 2021-09-03 02:30:25 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-09-03 02:30:25 +0000 |
commit | 27c1b3f98b58edf690fda7caa2b14f34d6661598 (patch) | |
tree | 59963ef8b67df8f067c591e2aa83da3134d4cbce /helix-term/src/application.rs | |
parent | 5b920c53f0b2cb1d6f48ffa46659c65f7fb6fde5 (diff) |
dap: Extract a thread_states map
Diffstat (limited to 'helix-term/src/application.rs')
-rw-r--r-- | helix-term/src/application.rs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 24ebbf60..eed7b914 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -273,10 +273,12 @@ impl Application { all_threads_stopped, .. }) => { - debugger.is_running = false; + if let Some(thread_id) = thread_id { + debugger.thread_states.insert(thread_id, reason); // TODO: dap uses "type" || "reason" here + // whichever thread stops is made "current" (if no previously selected thread). + select_thread_id(&mut self.editor, thread_id, false).await; + } - // whichever thread stops is made "current" (if no previously selected thread). - select_thread_id(&mut self.editor, thread_id.unwrap(), false).await; let scope = match thread_id { Some(id) => format!("Thread {}", id), @@ -296,6 +298,15 @@ impl Application { self.editor.set_status(status); } + Event::Continued(events::Continued { thread_id, .. }) => { + debugger.thread_states.remove(&thread_id); + if debugger.thread_id == Some(thread_id) { + resume_application(debugger) + } + } + Event::Thread(_) => { + // TODO: update thread_states, make threads request + } Event::Output(events::Output { category, output, .. }) => { @@ -315,12 +326,6 @@ impl Application { self.editor .set_status("Debugged application started".to_owned()); } - Event::Continued(events::Continued { thread_id, .. }) => { - // TODO: remove thread from thread-states - if debugger.thread_id == Some(thread_id) { - resume_application(debugger) - } - } ev => { log::warn!("Unhandled event {:?}", ev); return; // return early to skip render |