debugger: Add close button and coloring to debug panel session's menu (#28310)
This PR adds colors to debug panel's session menu that indicate the state of each respective session. It also adds a close button to each entry. green - running yellow - stopped red - terminated/ended Release Notes: - N/A
This commit is contained in:
parent
ee7b1ec7f2
commit
1774cad933
6 changed files with 173 additions and 44 deletions
|
@ -1,7 +1,7 @@
|
|||
use super::{
|
||||
breakpoint_store::BreakpointStore,
|
||||
locator_store::LocatorStore,
|
||||
session::{self, Session},
|
||||
session::{self, Session, SessionStateEvent},
|
||||
};
|
||||
use crate::{ProjectEnvironment, debugger, worktree_store::WorktreeStore};
|
||||
use anyhow::{Result, anyhow};
|
||||
|
@ -869,6 +869,15 @@ fn create_new_session(
|
|||
}
|
||||
|
||||
this.update(cx, |_, cx| {
|
||||
cx.subscribe(
|
||||
&session,
|
||||
move |this: &mut DapStore, _, event: &SessionStateEvent, cx| match event {
|
||||
SessionStateEvent::Shutdown => {
|
||||
this.shutdown_session(session_id, cx).detach_and_log_err(cx);
|
||||
}
|
||||
},
|
||||
)
|
||||
.detach();
|
||||
cx.emit(DapStoreEvent::DebugSessionInitialized(session_id));
|
||||
})?;
|
||||
|
||||
|
|
|
@ -832,7 +832,12 @@ pub enum SessionEvent {
|
|||
Threads,
|
||||
}
|
||||
|
||||
pub(crate) enum SessionStateEvent {
|
||||
Shutdown,
|
||||
}
|
||||
|
||||
impl EventEmitter<SessionEvent> for Session {}
|
||||
impl EventEmitter<SessionStateEvent> for Session {}
|
||||
|
||||
// local session will send breakpoint updates to DAP for all new breakpoints
|
||||
// remote side will only send breakpoint updates when it is a breakpoint created by that peer
|
||||
|
@ -1553,6 +1558,8 @@ impl Session {
|
|||
)
|
||||
};
|
||||
|
||||
cx.emit(SessionStateEvent::Shutdown);
|
||||
|
||||
cx.background_spawn(async move {
|
||||
let _ = task.await;
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue