@@ -19,7 +19,7 @@ use project::Project;
use rpc::proto::{self, PeerId};
use running::RunningState;
use starting::{StartingEvent, StartingState};
-use ui::prelude::*;
+use ui::{prelude::*, Indicator};
use util::ResultExt;
use workspace::{
item::{self, Item},
@@ -214,23 +214,48 @@ impl Focusable for DebugSession {
impl Item for DebugSession {
type Event = DebugPanelItemEvent;
fn tab_content(&self, _: item::TabContentParams, _: &Window, cx: &App) -> AnyElement {
- let (label, color) = match &self.mode {
- DebugSessionState::Inert(_) => ("New Session", Color::Default),
- DebugSessionState::Starting(_) => ("Starting", Color::Default),
- DebugSessionState::Failed(_) => ("Failed", Color::Error),
- DebugSessionState::Running(state) => (
- state
- .read_with(cx, |state, cx| state.thread_status(cx))
- .map(|status| status.label())
- .unwrap_or("Running"),
- Color::Default,
+ let (icon, label, color) = match &self.mode {
+ DebugSessionState::Inert(_) => (None, "New Session", Color::Default),
+ DebugSessionState::Starting(_) => (None, "Starting", Color::Default),
+ DebugSessionState::Failed(_) => (
+ Some(Indicator::dot().color(Color::Error)),
+ "Failed",
+ Color::Error,
),
+ DebugSessionState::Running(state) => {
+ if state.read(cx).session().read(cx).is_terminated() {
+ (
+ Some(Indicator::dot().color(Color::Error)),
+ "Terminated",
+ Color::Error,
+ )
+ } else {
+ match state.read(cx).thread_status(cx).unwrap_or_default() {
+ project::debugger::session::ThreadStatus::Stopped => (
+ Some(Indicator::dot().color(Color::Conflict)),
+ state
+ .read_with(cx, |state, cx| state.thread_status(cx))
+ .map(|status| status.label())
+ .unwrap_or("Stopped"),
+ Color::Conflict,
+ ),
+ _ => (
+ Some(Indicator::dot().color(Color::Success)),
+ state
+ .read_with(cx, |state, cx| state.thread_status(cx))
+ .map(|status| status.label())
+ .unwrap_or("Running"),
+ Color::Success,
+ ),
+ }
+ }
+ }
};
let is_starting = matches!(self.mode, DebugSessionState::Starting(_));
h_flex()
- .gap_1()
+ .gap_2()
.children(is_starting.then(|| {
Icon::new(IconName::ArrowCircle).with_animation(
"starting-debug-session",
@@ -238,6 +263,8 @@ impl Item for DebugSession {
|this, delta| this.transform(Transformation::rotate(percentage(delta))),
)
}))
+ .when_some(icon, |this, indicator| this.child(indicator))
+ .justify_between()
.child(Label::new(label).color(color))
.into_any_element()
}