@@ -187,66 +187,7 @@ impl Application {
189 Some(payload) = self.editor.debugger_events.next() => {
189 Some(payload) = self.editor.debugger_events.next() => {
190− if self.editor.debugger.is_none() {
190+ self.handle_debugger_message(payload).await;
193− let mut debugger = self.editor.debugger.as_mut().unwrap();
195− Payload::Event(ev) => {
196− match &ev.event[..] {
198− debugger.is_running = false;
203− .and_then(|threads| threads.get(0).cloned());
204− if let Some(main) = main {
205− let (bt, _) = debugger.stack_trace(main.id).await.unwrap();
206− debugger.stack_pointer = bt.get(0).cloned();
209− let body: helix_dap::events::Stopped = from_value(ev.body.expect("`stopped` event must have a body")).unwrap();
210− let scope = match body.thread_id {
211− Some(id) => format!("Thread {}", id),
212− None => "Target".to_owned(),
215− let mut status = format!("{} stopped because of {}", scope, body.reason);
216− if let Some(desc) = body.description {
217− status.push_str(&format!(" {}", desc));
219− if let Some(text) = body.text {
220− status.push_str(&format!(" {}", text));
222− if body.all_threads_stopped == Some(true) {
223− status.push_str(" (all threads stopped)");
226− self.editor.set_status(status);
230− let body: helix_dap::events::Output = from_value(ev.body.expect("`output` event must have a body")).unwrap();
232− let prefix = match body.category {
233− Some(category) => format!("Debug ({}):", category),
234− None => "Debug:".to_owned(),
237− self.editor.set_status(format!("{} {}", prefix, body.output));
241− self.editor.set_status("Debugged application started".to_owned());
247− Payload::Response(_) => unreachable!(),
248− Payload::Request(_) => todo!(),
251 Some(callback) = self.jobs.futures.next() => {
192 Some(callback) = self.jobs.futures.next() => {
252 self.jobs.handle_callback(&mut self.editor, &mut self.compositor, callback);
193 self.jobs.handle_callback(&mut self.editor, &mut self.compositor, callback);
@@ -309,7 +250,70 @@ impl Application {
312− pub async fn handle_debugger_message(&mut self, _call: ()) {
253+ pub async fn handle_debugger_message(&mut self, payload: helix_dap::Payload) {
254+ let mut debugger = match self.editor.debugger.as_mut() {
255+ Some(debugger) => debugger,
260+ Payload::Event(ev) => match &ev.event[..] {
262+ debugger.is_running = false;
267+ .and_then(|threads| threads.get(0).cloned());
268+ if let Some(main) = main {
269+ let (bt, _) = debugger.stack_trace(main.id).await.unwrap();
270+ debugger.stack_pointer = bt.get(0).cloned();
273+ let body: helix_dap::events::Stopped =
274+ from_value(ev.body.expect("`stopped` event must have a body")).unwrap();
275+ let scope = match body.thread_id {
276+ Some(id) => format!("Thread {}", id),
277+ None => "Target".to_owned(),
280+ let mut status = format!("{} stopped because of {}", scope, body.reason);
281+ if let Some(desc) = body.description {
282+ status.push_str(&format!(" {}", desc));
284+ if let Some(text) = body.text {
285+ status.push_str(&format!(" {}", text));
287+ if body.all_threads_stopped == Some(true) {
288+ status.push_str(" (all threads stopped)");
291+ self.editor.set_status(status);
295+ let body: helix_dap::events::Output =
296+ from_value(ev.body.expect("`output` event must have a body")).unwrap();
298+ let prefix = match body.category {
299+ Some(category) => format!("Debug ({}):", category),
300+ None => "Debug:".to_owned(),
304+ .set_status(format!("{} {}", prefix, body.output));
309+ .set_status("Debugged application started".to_owned());
314+ Payload::Response(_) => unreachable!(),
315+ Payload::Request(_) => todo!(),