Open keymap editor from command palette entry (#40825)

Release Notes:

- Adds footer to the command palette with buttons to add or change the
selected actions keybinding. Both open the keymap editor though the add
button takes you directly to the modal for recording a new keybind.


https://github.com/user-attachments/assets/0ee6b91e-b1dd-4d7f-ad64-cc79689ceeb2

---------

Co-authored-by: Joseph T. Lyons <JosephTLyons@gmail.com>
Co-authored-by: Julia Ryan <juliaryan3.14@gmail.com>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
This commit is contained in:
David Kleingeld
2025-10-28 15:14:58 +00:00
committed by GitHub
co-authored by Joseph T. Lyons Julia Ryan Danilo Leal
parent c656101862
commit 233a1eb46e
6 changed files with 158 additions and 12 deletions
+12
View File
@@ -68,6 +68,18 @@ impl KeyBinding {
pub fn for_action_in(action: &dyn Action, focus: &FocusHandle, cx: &App) -> Self {
Self::new(action, Some(focus.clone()), cx)
}
pub fn has_binding(&self, window: &Window) -> bool {
match &self.source {
Source::Action {
action,
focus_handle: Some(focus),
} => window
.highest_precedence_binding_for_action_in(action.as_ref(), focus)
.or_else(|| window.highest_precedence_binding_for_action(action.as_ref()))
.is_some(),
_ => false,
}
}
pub fn set_vim_mode(cx: &mut App, enabled: bool) {
cx.set_global(VimStyle(enabled));