debugger: Add a couple more keybindings (#31103)

- Add missing handler for `debugger::Continue` so `f5` works
- Add bindings based on VS Code for `debugger::Restart` and
`debug_panel::ToggleFocus`
- Remove breakpoint-related buttons from the debug panel's top strip,
and surface the bindings for `editor::ToggleBreakpoint` in gutter
tooltip instead

Release Notes:

- Debugger Beta: Added keybindings for `debugger::Continue`,
`debugger::Restart`, and `debug_panel::ToggleFocus`.
- Debugger Beta: Removed breakpoint-related buttons from the top of the
debug panel.
- Compatibility note: on Linux, `ctrl-shift-d` is now bound to
`debug_panel::ToggleFocus` by default, instead of
`editor::DuplicateLineDown`.
This commit is contained in:
Cole Miller 2025-05-21 20:59:44 -04:00 committed by GitHub
parent b2a92097ee
commit 5f452dbca2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 32 additions and 62 deletions

View file

@ -7266,24 +7266,22 @@ impl Editor {
..Default::default()
};
let primary_action_text = if breakpoint.is_disabled() {
"enable"
"Enable breakpoint"
} else if is_phantom && !collides_with_existing {
"set"
"Set breakpoint"
} else {
"unset"
"Unset breakpoint"
};
let mut primary_text = format!("Click to {primary_action_text}");
if collides_with_existing && !breakpoint.is_disabled() {
use std::fmt::Write;
write!(primary_text, ", {alt_as_text}-click to disable").ok();
}
let primary_text = SharedString::from(primary_text);
let focus_handle = self.focus_handle.clone();
let meta = if is_rejected {
"No executable code is associated with this line."
SharedString::from("No executable code is associated with this line.")
} else if collides_with_existing && !breakpoint.is_disabled() {
SharedString::from(format!(
"{alt_as_text}-click to disable,\nright-click for more options."
))
} else {
"Right-click for more options."
SharedString::from("Right-click for more options.")
};
IconButton::new(("breakpoint_indicator", row.0 as usize), icon)
.icon_size(IconSize::XSmall)
@ -7322,7 +7320,14 @@ impl Editor {
);
}))
.tooltip(move |window, cx| {
Tooltip::with_meta_in(primary_text.clone(), None, meta, &focus_handle, window, cx)
Tooltip::with_meta_in(
primary_action_text,
Some(&ToggleBreakpoint),
meta.clone(),
&focus_handle,
window,
cx,
)
})
}