|
|
|
@ -321,13 +321,14 @@ impl Application {
|
|
|
|
|
pub async fn handle_debugger_message(&mut self, payload: helix_dap::Payload) {
|
|
|
|
|
use crate::commands::dap::{breakpoints_changed, resume_application, select_thread_id};
|
|
|
|
|
use helix_dap::{events, Event};
|
|
|
|
|
|
|
|
|
|
match payload {
|
|
|
|
|
Payload::Event(ev) => {
|
|
|
|
|
let debugger = match self.editor.debugger.as_mut() {
|
|
|
|
|
Some(debugger) => debugger,
|
|
|
|
|
None => return,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
match payload {
|
|
|
|
|
Payload::Event(ev) => match ev {
|
|
|
|
|
match ev {
|
|
|
|
|
Event::Stopped(events::Stopped {
|
|
|
|
|
thread_id,
|
|
|
|
|
description,
|
|
|
|
@ -386,7 +387,8 @@ impl Application {
|
|
|
|
|
Event::Thread(_) => {
|
|
|
|
|
// TODO: update thread_states, make threads request
|
|
|
|
|
}
|
|
|
|
|
Event::Breakpoint(events::Breakpoint { reason, breakpoint }) => match &reason[..] {
|
|
|
|
|
Event::Breakpoint(events::Breakpoint { reason, breakpoint }) => {
|
|
|
|
|
match &reason[..] {
|
|
|
|
|
"new" => {
|
|
|
|
|
if let Some(source) = breakpoint.source {
|
|
|
|
|
self.editor
|
|
|
|
@ -405,18 +407,21 @@ impl Application {
|
|
|
|
|
}
|
|
|
|
|
"changed" => {
|
|
|
|
|
for breakpoints in self.editor.breakpoints.values_mut() {
|
|
|
|
|
if let Some(i) = breakpoints.iter().position(|b| b.id == breakpoint.id)
|
|
|
|
|
if let Some(i) =
|
|
|
|
|
breakpoints.iter().position(|b| b.id == breakpoint.id)
|
|
|
|
|
{
|
|
|
|
|
breakpoints[i].verified = breakpoint.verified;
|
|
|
|
|
breakpoints[i].message = breakpoint.message.clone();
|
|
|
|
|
breakpoints[i].line = breakpoint.line.unwrap().saturating_sub(1); // TODO: no unwrap
|
|
|
|
|
breakpoints[i].line =
|
|
|
|
|
breakpoint.line.unwrap().saturating_sub(1); // TODO: no unwrap
|
|
|
|
|
breakpoints[i].column = breakpoint.column;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"removed" => {
|
|
|
|
|
for breakpoints in self.editor.breakpoints.values_mut() {
|
|
|
|
|
if let Some(i) = breakpoints.iter().position(|b| b.id == breakpoint.id)
|
|
|
|
|
if let Some(i) =
|
|
|
|
|
breakpoints.iter().position(|b| b.id == breakpoint.id)
|
|
|
|
|
{
|
|
|
|
|
breakpoints.remove(i);
|
|
|
|
|
}
|
|
|
|
@ -425,7 +430,8 @@ impl Application {
|
|
|
|
|
reason => {
|
|
|
|
|
warn!("Unknown breakpoint event: {}", reason);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Event::Output(events::Output {
|
|
|
|
|
category, output, ..
|
|
|
|
|
}) => {
|
|
|
|
@ -459,9 +465,10 @@ impl Application {
|
|
|
|
|
log::warn!("Unhandled event {:?}", ev);
|
|
|
|
|
return; // return early to skip render
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Payload::Response(_) => unreachable!(),
|
|
|
|
|
Payload::Request(_) => todo!(),
|
|
|
|
|
Payload::Request(request) => unimplemented!("{:?}", request),
|
|
|
|
|
}
|
|
|
|
|
self.render();
|
|
|
|
|
}
|
|
|
|
|