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