Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

keymap_ui: Ensure keymap UI opens in local workspace (#34291)

Ben Kunkle496bf0ec43b7
diff --git a/crates/settings_ui/src/keybindings.rs b/crates/settings_ui/src/keybindings.rs
index 159756c975d..993ed1bbbf2 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::<KeymapEditor>());
-
- 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);
- }
- });
+ workspace
+ .with_local_workspace(window, cx, |workspace, window, cx| {
+ let existing = workspace
+ .active_pane()
+ .read(cx)
+ .items()
+ .find_map(|item| item.downcast::<KeymapEditor>());
+
+ 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| {