Skip to content

Commit

Permalink
Fix todo for removing highlights on exited event
Browse files Browse the repository at this point in the history
  • Loading branch information
RemcoSmitsDev committed Sep 25, 2024
1 parent b0f92c1 commit cd8615a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions crates/debugger_ui/src/debugger_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use workspace::{pane, Pane, Start};

pub enum DebugPanelEvent {
Exited(DebugAdapterClientId),
Terminated(DebugAdapterClientId),
Stopped {
client_id: DebugAdapterClientId,
event: StoppedEvent,
Expand Down Expand Up @@ -516,8 +517,6 @@ impl DebugPanel {
) {
let restart_args = event.clone().and_then(|e| e.restart);

// TODO debugger: remove current highlights

self.dap_store.update(cx, |store, cx| {
if restart_args.is_some() {
store
Expand All @@ -527,6 +526,8 @@ impl DebugPanel {
store.shutdown_client(&client_id, cx).detach_and_log_err(cx);
}
});

cx.emit(DebugPanelEvent::Terminated(*client_id));
}

fn handle_output_event(
Expand Down
14 changes: 7 additions & 7 deletions crates/debugger_ui/src/debugger_panel_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ impl DebugPanelItem {
DebugPanelEvent::Continued((client_id, event)) => {
this.handle_thread_continued_event(client_id, event, cx);
}
DebugPanelEvent::Exited(client_id) => {
this.handle_client_exited_event(client_id, cx);
DebugPanelEvent::Exited(client_id) | DebugPanelEvent::Terminated(client_id) => {
this.handle_client_exited_and_terminated_event(client_id, cx);
}
};
}
Expand Down Expand Up @@ -159,6 +159,8 @@ impl DebugPanelItem {
cx.notify();
});

self.clear_highlights(cx);

cx.notify();
}

Expand Down Expand Up @@ -274,12 +276,10 @@ impl DebugPanelItem {

self.update_thread_state_status(ThreadStatus::Stopped, cx);

self.remove_highlights(cx);

cx.emit(Event::Close);
}

fn handle_client_exited_event(
fn handle_client_exited_and_terminated_event(
&mut self,
client_id: &DebugAdapterClientId,
cx: &mut ViewContext<Self>,
Expand Down Expand Up @@ -330,7 +330,7 @@ impl DebugPanelItem {
cx.notify();
}

fn remove_highlights(&self, cx: &mut ViewContext<Self>) {
fn clear_highlights(&self, cx: &mut ViewContext<Self>) {
self.workspace
.update(cx, |workspace, cx| {
let editor_views = workspace
Expand Down Expand Up @@ -363,7 +363,7 @@ impl DebugPanelItem {
}

pub fn go_to_stack_frame(&mut self, cx: &mut ViewContext<Self>) {
self.remove_highlights(cx);
self.clear_highlights(cx);

let stack_frame = self
.thread_state
Expand Down

0 comments on commit cd8615a

Please sign in to comment.