Skip to content

Commit

Permalink
Implement handler for continued event
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony-Eid committed Jul 15, 2024
1 parent 3e1aa65 commit 73ef771
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions crates/debugger_ui/src/debugger_panel.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use anyhow::Result;
use dap::client::{DebugAdapterClientId, ThreadState, ThreadStatus};
use dap::client::{self, DebugAdapterClientId, ThreadState, ThreadStatus};
use dap::requests::{Disconnect, Scopes, StackTrace, Variables};
use dap::{client::DebugAdapterClient, transport::Events};
use dap::{
DisconnectArguments, Scope, ScopesArguments, StackFrame, StackTraceArguments, StoppedEvent,
TerminatedEvent, ThreadEvent, ThreadEventReason, Variable, VariablesArguments,
ContinuedEvent, DisconnectArguments, Scope, ScopesArguments, StackFrame, StackTraceArguments,
StoppedEvent, TerminatedEvent, ThreadEvent, ThreadEventReason, Variable, VariablesArguments,
};
use editor::Editor;
use futures::future::try_join_all;
Expand Down Expand Up @@ -134,7 +134,7 @@ impl DebugPanel {
.detach_and_log_err(cx);
}
Events::Stopped(event) => Self::handle_stopped_event(this, client_id, event, cx),
Events::Continued(_) => {}
Events::Continued(event) => Self::handle_continued_event(this, client_id, event, cx),
Events::Exited(_) => {}
Events::Terminated(event) => Self::handle_terminated_event(this, client_id, event, cx),
Events::Thread(event) => Self::handle_thread_event(this, client_id, event, cx),
Expand Down Expand Up @@ -272,6 +272,24 @@ impl DebugPanel {
})
}

fn handle_continued_event(
this: &mut Self,
client_id: &DebugAdapterClientId,
event: &ContinuedEvent,
cx: &mut ViewContext<Self>,
) {
let all_threads = event.all_threads_continued.unwrap_or(false);
let client = this.debug_client_by_id(client_id.clone(), cx);

if all_threads {
for thread in client.thread_states().values_mut() {
thread.status = ThreadStatus::Running;
}
} else {
client.update_thread_state_status(event.thread_id, ThreadStatus::Running);
}
}

fn handle_stopped_event(
this: &mut Self,
client_id: &DebugAdapterClientId,
Expand Down

0 comments on commit 73ef771

Please sign in to comment.