debugger: Add actions and keybindings for opening the thread and session menus (#31135)
Makes it possible to open and navigate these menus from the keyboard. I also removed the eager previewing behavior for the thread picker, which was buggy and came with a jarring layout shift. Release Notes: - Debugger Beta: Added the `debugger: open thread picker` and `debugger: open session picker` actions.
This commit is contained in:
parent
eb35d25a7d
commit
b2a92097ee
8 changed files with 76 additions and 68 deletions
|
@ -2,6 +2,8 @@ use gpui::{ClickEvent, Corner, CursorStyle, Entity, Hsla, MouseButton};
|
|||
|
||||
use crate::{ContextMenu, PopoverMenu, prelude::*};
|
||||
|
||||
use super::PopoverMenuHandle;
|
||||
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub enum DropdownStyle {
|
||||
#[default]
|
||||
|
@ -22,6 +24,7 @@ pub struct DropdownMenu {
|
|||
menu: Entity<ContextMenu>,
|
||||
full_width: bool,
|
||||
disabled: bool,
|
||||
handle: Option<PopoverMenuHandle<ContextMenu>>,
|
||||
}
|
||||
|
||||
impl DropdownMenu {
|
||||
|
@ -37,6 +40,7 @@ impl DropdownMenu {
|
|||
menu,
|
||||
full_width: false,
|
||||
disabled: false,
|
||||
handle: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,6 +56,7 @@ impl DropdownMenu {
|
|||
menu,
|
||||
full_width: false,
|
||||
disabled: false,
|
||||
handle: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,6 +69,11 @@ impl DropdownMenu {
|
|||
self.full_width = full_width;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn handle(mut self, handle: PopoverMenuHandle<ContextMenu>) -> Self {
|
||||
self.handle = Some(handle);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl Disableable for DropdownMenu {
|
||||
|
@ -85,6 +95,7 @@ impl RenderOnce for DropdownMenu {
|
|||
.style(self.style),
|
||||
)
|
||||
.attach(Corner::BottomLeft)
|
||||
.when_some(self.handle.clone(), |el, handle| el.with_handle(handle))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,17 +170,11 @@ pub struct DropdownTriggerStyle {
|
|||
impl DropdownTriggerStyle {
|
||||
pub fn for_style(style: DropdownStyle, cx: &App) -> Self {
|
||||
let colors = cx.theme().colors();
|
||||
|
||||
if style == DropdownStyle::Solid {
|
||||
Self {
|
||||
// why is this editor_background?
|
||||
bg: colors.editor_background,
|
||||
}
|
||||
} else {
|
||||
Self {
|
||||
bg: colors.ghost_element_background,
|
||||
}
|
||||
}
|
||||
let bg = match style {
|
||||
DropdownStyle::Solid => colors.editor_background,
|
||||
DropdownStyle::Ghost => colors.ghost_element_background,
|
||||
};
|
||||
Self { bg }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue