From 496bf0ec43b74c20cc6e593bb7ee4db419332bf7 Mon Sep 17 00:00:00 2001 From: Ben Kunkle Date: Fri, 11 Jul 2025 10:32:59 -0500 Subject: [PATCH] keymap_ui: Ensure keymap UI opens in local workspace (#34291) Closes #ISSUE Use `workspace.with_local_workspace` to ensure the keymap UI is opened in a local workspace, even in remote. This was tested by removing the feature flag handling code, as with the feature flag logic the action does not appear which is likely a bug. Release Notes: - N/A *or* Added/Fixed/Improved ... --- crates/settings_ui/src/keybindings.rs | 36 +++++++++++++++++---------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/crates/settings_ui/src/keybindings.rs b/crates/settings_ui/src/keybindings.rs index 159756c975..993ed1bbbf 100644 --- a/crates/settings_ui/src/keybindings.rs +++ b/crates/settings_ui/src/keybindings.rs @@ -71,20 +71,30 @@ pub fn init(cx: &mut App) { cx.on_action(|_: &OpenKeymapEditor, cx| { workspace::with_active_or_new_workspace(cx, move |workspace, window, cx| { - let existing = workspace - .active_pane() - .read(cx) - .items() - .find_map(|item| item.downcast::()); + workspace + .with_local_workspace(window, cx, |workspace, window, cx| { + let existing = workspace + .active_pane() + .read(cx) + .items() + .find_map(|item| item.downcast::()); - if let Some(existing) = existing { - workspace.activate_item(&existing, true, true, window, cx); - } else { - let keymap_editor = - cx.new(|cx| KeymapEditor::new(workspace.weak_handle(), window, cx)); - workspace.add_item_to_active_pane(Box::new(keymap_editor), None, true, window, cx); - } - }); + if let Some(existing) = existing { + workspace.activate_item(&existing, true, true, window, cx); + } else { + let keymap_editor = + cx.new(|cx| KeymapEditor::new(workspace.weak_handle(), window, cx)); + workspace.add_item_to_active_pane( + Box::new(keymap_editor), + None, + true, + window, + cx, + ); + } + }) + .detach(); + }) }); cx.observe_new(|_workspace: &mut Workspace, window, cx| {