From 62da0dc402cae8494dfec57a6364ef0d1b2cc082 Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Wed, 15 Oct 2025 00:36:04 -0400 Subject: [PATCH] Fix triggers for debugger thread and session lists not rendering (#40227) Release Notes: - N/A --- crates/debugger_ui/src/dropdown_menus.rs | 4 +- crates/ui/src/components/dropdown_menu.rs | 70 ++++++++++++++--------- 2 files changed, 46 insertions(+), 28 deletions(-) diff --git a/crates/debugger_ui/src/dropdown_menus.rs b/crates/debugger_ui/src/dropdown_menus.rs index 376a4a41ce7b03cd07f578d85f641a6ddfc4ebe8..e0c3628f4fc0a927857adbe93549087f930145d6 100644 --- a/crates/debugger_ui/src/dropdown_menus.rs +++ b/crates/debugger_ui/src/dropdown_menus.rs @@ -1,7 +1,7 @@ use std::rc::Rc; use collections::HashMap; -use gpui::{Entity, WeakEntity}; +use gpui::{Corner, Entity, WeakEntity}; use project::debugger::session::{ThreadId, ThreadStatus}; use ui::{CommonAnimationExt, ContextMenu, DropdownMenu, DropdownStyle, Indicator, prelude::*}; use util::{maybe, truncate_and_trailoff}; @@ -211,6 +211,7 @@ impl DebugPanel { this }), ) + .attach(Corner::BottomLeft) .style(DropdownStyle::Ghost) .handle(self.session_picker_menu_handle.clone()); @@ -322,6 +323,7 @@ impl DebugPanel { this }), ) + .attach(Corner::BottomLeft) .disabled(session_terminated) .style(DropdownStyle::Ghost) .handle(self.thread_picker_menu_handle.clone()), diff --git a/crates/ui/src/components/dropdown_menu.rs b/crates/ui/src/components/dropdown_menu.rs index 7a4d26db2dedc10d2353578ed99fa83dbe8ed0b5..1c1471f0c6447eea2fde75710512a8016dee5562 100644 --- a/crates/ui/src/components/dropdown_menu.rs +++ b/crates/ui/src/components/dropdown_menu.rs @@ -1,6 +1,6 @@ use gpui::{Corner, Entity, Pixels, Point}; -use crate::{ContextMenu, PopoverMenu, prelude::*}; +use crate::{ButtonLike, ContextMenu, PopoverMenu, prelude::*}; use super::PopoverMenuHandle; @@ -137,36 +137,52 @@ impl RenderOnce for DropdownMenu { let full_width = self.full_width; let trigger_size = self.trigger_size; - let button = match self.label { - LabelKind::Text(text) => Button::new(self.id.clone(), text) - .style(button_style) - .when(self.chevron, |this| { - this.icon(IconName::ChevronUpDown) - .icon_position(IconPosition::End) - .icon_size(IconSize::XSmall) - .icon_color(Color::Muted) - }) - .when(full_width, |this| this.full_width()) - .size(trigger_size) - .disabled(self.disabled), - LabelKind::Element(_element) => Button::new(self.id.clone(), "") - .style(button_style) - .when(self.chevron, |this| { - this.icon(IconName::ChevronUpDown) - .icon_position(IconPosition::End) - .icon_size(IconSize::XSmall) - .icon_color(Color::Muted) - }) - .when(full_width, |this| this.full_width()) - .size(trigger_size) - .disabled(self.disabled), - } - .when_some(self.tab_index, |this, tab_index| this.tab_index(tab_index)); + let (text_button, element_button) = match self.label { + LabelKind::Text(text) => ( + Some( + Button::new(self.id.clone(), text) + .style(button_style) + .when(self.chevron, |this| { + this.icon(IconName::ChevronUpDown) + .icon_position(IconPosition::End) + .icon_size(IconSize::XSmall) + .icon_color(Color::Muted) + }) + .when(full_width, |this| this.full_width()) + .size(trigger_size) + .disabled(self.disabled) + .when_some(self.tab_index, |this, tab_index| this.tab_index(tab_index)), + ), + None, + ), + LabelKind::Element(element) => ( + None, + Some( + ButtonLike::new(self.id.clone()) + .child(element) + .style(button_style) + .when(self.chevron, |this| { + this.child( + Icon::new(IconName::ChevronUpDown) + .size(IconSize::XSmall) + .color(Color::Muted), + ) + }) + .when(full_width, |this| this.full_width()) + .size(trigger_size) + .disabled(self.disabled) + .when_some(self.tab_index, |this, tab_index| this.tab_index(tab_index)), + ), + ), + }; PopoverMenu::new((self.id.clone(), "popover")) .full_width(self.full_width) .menu(move |_window, _cx| Some(self.menu.clone())) - .trigger(button) + .when_some(text_button, |this, text_button| this.trigger(text_button)) + .when_some(element_button, |this, element_button| { + this.trigger(element_button) + }) .attach(match self.attach { Some(attach) => attach, None => Corner::BottomRight,