Debugger UI: Update tab content and remove red tint from terminated session (#27475)

The new tab content makes it obvious when a session is shutdown so the
red tint is no longer needed.

Release Notes:

- N/A
This commit is contained in:
Anthony Eid 2025-03-26 03:13:12 -04:00 committed by GitHub
parent d70ac64fe4
commit a02f7e5cda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 39 additions and 14 deletions

View file

@ -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()
}