Debugger UI: Dynamic session contents (#28033)

Closes #ISSUE

Release Notes:

- N/A *or* Added/Fixed/Improved ...

---------

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Anthony <anthony@zed.dev>
This commit is contained in:
Piotr Osiewicz
2025-04-07 23:22:09 +02:00
committed by GitHub
co-authored by Anthony Eid Anthony
parent fdaf2a27bf
commit 22b937f27f
14 changed files with 663 additions and 537 deletions
@@ -687,6 +687,7 @@ impl VariableList {
.child(
ListItem::new(SharedString::from(format!("scope-{}", var_ref)))
.selectable(false)
.disabled(self.disabled)
.indent_level(state.depth + 1)
.indent_step_size(px(20.))
.always_show_disclosure_icon(true)
@@ -695,7 +696,15 @@ impl VariableList {
let var_path = entry.path.clone();
cx.listener(move |this, _, _, cx| this.toggle_entry(&var_path, cx))
})
.child(div().text_ui(cx).w_full().child(scope.name.clone())),
.child(
div()
.text_ui(cx)
.w_full()
.when(self.disabled, |this| {
this.text_color(Color::Disabled.color(cx))
})
.child(scope.name.clone()),
),
)
.into_any()
}
@@ -716,20 +725,27 @@ impl VariableList {
};
let syntax_color_for = |name| cx.theme().syntax().get(name).color;
let variable_name_color = match &dap
.presentation_hint
.as_ref()
.and_then(|hint| hint.kind.as_ref())
.unwrap_or(&VariablePresentationHintKind::Unknown)
{
VariablePresentationHintKind::Class
| VariablePresentationHintKind::BaseClass
| VariablePresentationHintKind::InnerClass
| VariablePresentationHintKind::MostDerivedClass => syntax_color_for("type"),
VariablePresentationHintKind::Data => syntax_color_for("variable"),
VariablePresentationHintKind::Unknown | _ => syntax_color_for("variable"),
let variable_name_color = if self.disabled {
Some(Color::Disabled.color(cx))
} else {
match &dap
.presentation_hint
.as_ref()
.and_then(|hint| hint.kind.as_ref())
.unwrap_or(&VariablePresentationHintKind::Unknown)
{
VariablePresentationHintKind::Class
| VariablePresentationHintKind::BaseClass
| VariablePresentationHintKind::InnerClass
| VariablePresentationHintKind::MostDerivedClass => syntax_color_for("type"),
VariablePresentationHintKind::Data => syntax_color_for("variable"),
VariablePresentationHintKind::Unknown | _ => syntax_color_for("variable"),
}
};
let variable_color = syntax_color_for("variable.special");
let variable_color = self
.disabled
.then(|| Color::Disabled.color(cx))
.or_else(|| syntax_color_for("variable.special"));
let var_ref = dap.variables_reference;
let colors = get_entry_color(cx);