Debugger: Basic breakpoint improvements (#27687)

This PR does three things

- Right clicking within the gutter outside of the gutter fold area
bounds opens a breakpoint context menu
- Disabled breakpoints are now outline with the debugger accent color
instead of being fully colored at half opacity
- Clicking a breakpoint acts differently now
- Clicking a breakpoint while holding the platform modifier key will
disable/enable it
- Clicking a breakpoint hint while holding the platform modifier key
will set a disabled breakpoint
- Clicking a disabled breakpoint will enable it instead of deleting it

Release Notes:

- N/A
This commit is contained in:
Anthony Eid 2025-03-28 15:55:09 -04:00 committed by GitHub
parent b5dc09c0ca
commit 28f0ba3381
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 44 additions and 9 deletions

View file

@ -6279,20 +6279,22 @@ impl Editor {
cx: &mut Context<Self>,
) -> IconButton {
let (color, icon) = {
let icon = match (&breakpoint.kind, breakpoint.is_disabled()) {
(BreakpointKind::Standard, false) => ui::IconName::DebugBreakpoint,
(BreakpointKind::Log(_), false) => ui::IconName::DebugLogBreakpoint,
(BreakpointKind::Standard, true) => ui::IconName::DebugDisabledBreakpoint,
(BreakpointKind::Log(_), true) => ui::IconName::DebugDisabledLogBreakpoint,
};
let color = if self
.gutter_breakpoint_indicator
.is_some_and(|point| point.row() == row)
{
Color::Hint
} else if breakpoint.is_disabled() {
Color::Custom(Color::Debugger.color(cx).opacity(0.5))
} else {
Color::Debugger
};
let icon = match &breakpoint.kind {
BreakpointKind::Standard => ui::IconName::DebugBreakpoint,
BreakpointKind::Log(_) => ui::IconName::DebugLogBreakpoint,
};
(color, icon)
};
@ -6306,12 +6308,18 @@ impl Editor {
.on_click(cx.listener({
let breakpoint = breakpoint.clone();
move |editor, _e, window, cx| {
move |editor, event: &ClickEvent, window, cx| {
let edit_action = if event.modifiers().platform || breakpoint.is_disabled() {
BreakpointEditAction::InvertState
} else {
BreakpointEditAction::Toggle
};
window.focus(&editor.focus_handle(cx));
editor.edit_breakpoint_at_anchor(
position,
breakpoint.as_ref().clone(),
BreakpointEditAction::Toggle,
edit_action,
cx,
);
}