diff --git a/crates/collab_ui/src/contact_list.rs b/crates/collab_ui/src/contact_list.rs index 87aa41b7a4658af0c171b8d9b39eeb4431c0cc77..452867b8c4dd6d74a8ba23b77120f7472dbde7e1 100644 --- a/crates/collab_ui/src/contact_list.rs +++ b/crates/collab_ui/src/contact_list.rs @@ -1306,10 +1306,9 @@ impl View for ContactList { "ContactList" } - fn keymap_context(&self, _: &AppContext) -> KeymapContext { - let mut cx = Self::default_keymap_context(); - cx.add_identifier("menu"); - cx + fn update_keymap_context(&self, keymap: &mut KeymapContext, _: &AppContext) { + Self::reset_to_default_keymap_context(keymap); + keymap.add_identifier("menu"); } fn render(&mut self, cx: &mut ViewContext) -> AnyElement { diff --git a/crates/context_menu/src/context_menu.rs b/crates/context_menu/src/context_menu.rs index e0429bd01b6203ad2a75d7709b2d1f0c0c5e1e2e..0a4cd59384b1ee4590fcd2d8fd11df0815a238dc 100644 --- a/crates/context_menu/src/context_menu.rs +++ b/crates/context_menu/src/context_menu.rs @@ -140,10 +140,9 @@ impl View for ContextMenu { "ContextMenu" } - fn keymap_context(&self, _: &AppContext) -> KeymapContext { - let mut cx = Self::default_keymap_context(); - cx.add_identifier("menu"); - cx + fn update_keymap_context(&self, keymap: &mut KeymapContext, _: &AppContext) { + Self::reset_to_default_keymap_context(keymap); + keymap.add_identifier("menu"); } fn render(&mut self, cx: &mut ViewContext) -> AnyElement { diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index be57596584e318145bb3191b374d9f66b813d8ef..641ef4d133a40b11b1605660aa42eaa1510472fe 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -1425,13 +1425,19 @@ impl Editor { } } - pub fn set_keymap_context_layer(&mut self, context: KeymapContext) { + pub fn set_keymap_context_layer( + &mut self, + context: KeymapContext, + cx: &mut ViewContext, + ) { self.keymap_context_layers .insert(TypeId::of::(), context); + cx.notify(); } - pub fn remove_keymap_context_layer(&mut self) { + pub fn remove_keymap_context_layer(&mut self, cx: &mut ViewContext) { self.keymap_context_layers.remove(&TypeId::of::()); + cx.notify(); } pub fn set_input_enabled(&mut self, input_enabled: bool) { @@ -7157,28 +7163,26 @@ impl View for Editor { false } - fn keymap_context(&self, _: &AppContext) -> KeymapContext { - let mut context = Self::default_keymap_context(); + fn update_keymap_context(&self, keymap: &mut KeymapContext, _: &AppContext) { + Self::reset_to_default_keymap_context(keymap); let mode = match self.mode { EditorMode::SingleLine => "single_line", EditorMode::AutoHeight { .. } => "auto_height", EditorMode::Full => "full", }; - context.add_key("mode", mode); + keymap.add_key("mode", mode); if self.pending_rename.is_some() { - context.add_identifier("renaming"); + keymap.add_identifier("renaming"); } match self.context_menu.as_ref() { - Some(ContextMenu::Completions(_)) => context.add_identifier("showing_completions"), - Some(ContextMenu::CodeActions(_)) => context.add_identifier("showing_code_actions"), + Some(ContextMenu::Completions(_)) => keymap.add_identifier("showing_completions"), + Some(ContextMenu::CodeActions(_)) => keymap.add_identifier("showing_code_actions"), None => {} } for layer in self.keymap_context_layers.values() { - context.extend(layer); + keymap.extend(layer); } - - context } fn text_for_range(&self, range_utf16: Range, cx: &AppContext) -> Option { diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 4d84f7c070fd179ec3220054b1f3fff2041ed3e5..caebc2714a5fd66920c3b3efe1f9ad2112f64bc7 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -83,14 +83,15 @@ pub trait View: Entity + Sized { false } - fn keymap_context(&self, _: &AppContext) -> keymap_matcher::KeymapContext { - Self::default_keymap_context() + fn update_keymap_context(&self, keymap: &mut keymap_matcher::KeymapContext, _: &AppContext) { + Self::reset_to_default_keymap_context(keymap); } - fn default_keymap_context() -> keymap_matcher::KeymapContext { - let mut cx = keymap_matcher::KeymapContext::default(); - cx.add_identifier(Self::ui_name()); - cx + + fn reset_to_default_keymap_context(keymap: &mut keymap_matcher::KeymapContext) { + keymap.clear(); + keymap.add_identifier(Self::ui_name()); } + fn debug_json(&self, _: &AppContext) -> serde_json::Value { serde_json::Value::Null } @@ -440,6 +441,7 @@ type WindowShouldCloseSubscriptionCallback = Box b pub struct AppContext { models: HashMap>, views: HashMap<(usize, usize), Box>, + views_metadata: HashMap<(usize, usize), ViewMetadata>, pub(crate) parents: HashMap<(usize, usize), ParentId>, windows: HashMap, globals: HashMap>, @@ -502,6 +504,7 @@ impl AppContext { Self { models: Default::default(), views: Default::default(), + views_metadata: Default::default(), parents: Default::default(), windows: Default::default(), globals: Default::default(), @@ -727,9 +730,9 @@ impl AppContext { } pub fn view_type_id(&self, window_id: usize, view_id: usize) -> Option { - self.views + self.views_metadata .get(&(window_id, view_id)) - .map(|view| view.as_any().type_id()) + .map(|metadata| metadata.type_id) } pub fn active_labeled_tasks<'a>( @@ -1045,9 +1048,10 @@ impl AppContext { .read_window(window_id, |cx| { if let Some(focused_view_id) = cx.focused_view_id() { for view_id in cx.ancestors(focused_view_id) { - if let Some(view) = cx.views.get(&(window_id, view_id)) { - let view_type = view.as_any().type_id(); - if let Some(actions) = cx.actions.get(&view_type) { + if let Some(view_metadata) = + cx.views_metadata.get(&(window_id, view_id)) + { + if let Some(actions) = cx.actions.get(&view_metadata.type_id) { if actions.contains_key(&action_type) { return true; } @@ -1448,6 +1452,7 @@ impl AppContext { for (window_id, view_id) in dropped_views { self.subscriptions.remove(view_id); self.observations.remove(view_id); + self.views_metadata.remove(&(window_id, view_id)); let mut view = self.views.remove(&(window_id, view_id)).unwrap(); view.release(self); let change_focus_to = self.windows.get_mut(&window_id).and_then(|window| { @@ -1779,9 +1784,11 @@ impl AppContext { observed_window_id: usize, observed_view_id: usize, ) { - if self + let view_key = (observed_window_id, observed_view_id); + if let Some((view, mut view_metadata)) = self .views - .contains_key(&(observed_window_id, observed_view_id)) + .remove(&view_key) + .zip(self.views_metadata.remove(&view_key)) { if let Some(window) = self.windows.get_mut(&observed_window_id) { window @@ -1791,6 +1798,10 @@ impl AppContext { .insert(observed_view_id); } + view.update_keymap_context(&mut view_metadata.keymap_context, self); + self.views.insert(view_key, view); + self.views_metadata.insert(view_key, view_metadata); + let mut observations = self.observations.clone(); observations.emit(observed_view_id, |callback| callback(self)); } @@ -2037,6 +2048,11 @@ pub enum ParentId { Root, } +struct ViewMetadata { + type_id: TypeId, + keymap_context: KeymapContext, +} + #[derive(Default, Clone)] pub struct WindowInvalidation { pub updated: HashSet, @@ -2365,7 +2381,7 @@ pub trait AnyView { cx: &mut WindowContext, view_id: usize, ) -> bool; - fn keymap_context(&self, cx: &AppContext) -> KeymapContext; + fn update_keymap_context(&self, keymap: &mut KeymapContext, cx: &AppContext); fn debug_json(&self, cx: &WindowContext) -> serde_json::Value; fn text_for_range(&self, range: Range, cx: &WindowContext) -> Option; @@ -2437,11 +2453,10 @@ where cx.handle().into_any() } else { let focused_type = cx - .views + .views_metadata .get(&(cx.window_id, focused_id)) .unwrap() - .as_any() - .type_id(); + .type_id; AnyViewHandle::new( cx.window_id, focused_id, @@ -2458,11 +2473,10 @@ where cx.handle().into_any() } else { let blurred_type = cx - .views + .views_metadata .get(&(cx.window_id, blurred_id)) .unwrap() - .as_any() - .type_id(); + .type_id; AnyViewHandle::new( cx.window_id, blurred_id, @@ -2493,8 +2507,8 @@ where View::modifiers_changed(self, event, &mut cx) } - fn keymap_context(&self, cx: &AppContext) -> KeymapContext { - View::keymap_context(self, cx) + fn update_keymap_context(&self, keymap: &mut KeymapContext, cx: &AppContext) { + View::update_keymap_context(self, keymap, cx) } fn debug_json(&self, cx: &WindowContext) -> serde_json::Value { @@ -5559,8 +5573,8 @@ mod tests { "View" } - fn keymap_context(&self, _: &AppContext) -> KeymapContext { - self.keymap_context.clone() + fn update_keymap_context(&self, keymap: &mut KeymapContext, _: &AppContext) { + *keymap = self.keymap_context.clone(); } } @@ -5664,7 +5678,7 @@ mod tests { } #[crate::test(self)] - fn test_keystrokes_for_action(cx: &mut AppContext) { + fn test_keystrokes_for_action(cx: &mut TestAppContext) { actions!(test, [Action1, Action2, GlobalAction]); struct View1 {} @@ -5694,70 +5708,76 @@ mod tests { } } - let (window_id, view_1) = cx.add_window(Default::default(), |_| View1 {}); + let (_, view_1) = cx.add_window(|_| View1 {}); let view_2 = cx.add_view(&view_1, |cx| { cx.focus_self(); View2 {} }); - cx.add_action(|_: &mut View1, _: &Action1, _cx| {}); - cx.add_action(|_: &mut View2, _: &Action2, _cx| {}); - cx.add_global_action(|_: &GlobalAction, _| {}); - - cx.add_bindings(vec![ - Binding::new("a", Action1, Some("View1")), - Binding::new("b", Action2, Some("View1 > View2")), - Binding::new("c", GlobalAction, Some("View3")), // View 3 does not exist - ]); + cx.update(|cx| { + cx.add_action(|_: &mut View1, _: &Action1, _cx| {}); + cx.add_action(|_: &mut View2, _: &Action2, _cx| {}); + cx.add_global_action(|_: &GlobalAction, _| {}); + + cx.add_bindings(vec![ + Binding::new("a", Action1, Some("View1")), + Binding::new("b", Action2, Some("View1 > View2")), + Binding::new("c", GlobalAction, Some("View3")), // View 3 does not exist + ]); + }); - cx.update_window(window_id, |cx| { - // Sanity check - assert_eq!( - cx.keystrokes_for_action(view_1.id(), &Action1) - .unwrap() - .as_slice(), - &[Keystroke::parse("a").unwrap()] - ); - assert_eq!( - cx.keystrokes_for_action(view_2.id(), &Action2) - .unwrap() - .as_slice(), - &[Keystroke::parse("b").unwrap()] - ); + // Here we update the views to ensure that, even if they are on the stack, + // we can still retrieve keystrokes correctly. + view_1.update(cx, |_, cx| { + view_2.update(cx, |_, cx| { + // Sanity check + assert_eq!( + cx.keystrokes_for_action(view_1.id(), &Action1) + .unwrap() + .as_slice(), + &[Keystroke::parse("a").unwrap()] + ); + assert_eq!( + cx.keystrokes_for_action(view_2.id(), &Action2) + .unwrap() + .as_slice(), + &[Keystroke::parse("b").unwrap()] + ); - // The 'a' keystroke propagates up the view tree from view_2 - // to view_1. The action, Action1, is handled by view_1. - assert_eq!( - cx.keystrokes_for_action(view_2.id(), &Action1) - .unwrap() - .as_slice(), - &[Keystroke::parse("a").unwrap()] - ); + // The 'a' keystroke propagates up the view tree from view_2 + // to view_1. The action, Action1, is handled by view_1. + assert_eq!( + cx.keystrokes_for_action(view_2.id(), &Action1) + .unwrap() + .as_slice(), + &[Keystroke::parse("a").unwrap()] + ); - // Actions that are handled below the current view don't have bindings - assert_eq!(cx.keystrokes_for_action(view_1.id(), &Action2), None); + // Actions that are handled below the current view don't have bindings + assert_eq!(cx.keystrokes_for_action(view_1.id(), &Action2), None); - // Actions that are handled in other branches of the tree should not have a binding - assert_eq!(cx.keystrokes_for_action(view_2.id(), &GlobalAction), None); + // Actions that are handled in other branches of the tree should not have a binding + assert_eq!(cx.keystrokes_for_action(view_2.id(), &GlobalAction), None); - // Check that global actions do not have a binding, even if a binding does exist in another view - assert_eq!( - &available_actions(view_1.id(), cx), - &[ - ("test::Action1", vec![Keystroke::parse("a").unwrap()]), - ("test::GlobalAction", vec![]) - ], - ); + // Check that global actions do not have a binding, even if a binding does exist in another view + assert_eq!( + &available_actions(view_1.id(), cx), + &[ + ("test::Action1", vec![Keystroke::parse("a").unwrap()]), + ("test::GlobalAction", vec![]) + ], + ); - // Check that view 1 actions and bindings are available even when called from view 2 - assert_eq!( - &available_actions(view_2.id(), cx), - &[ - ("test::Action1", vec![Keystroke::parse("a").unwrap()]), - ("test::Action2", vec![Keystroke::parse("b").unwrap()]), - ("test::GlobalAction", vec![]), - ], - ); + // Check that view 1 actions and bindings are available even when called from view 2 + assert_eq!( + &available_actions(view_2.id(), cx), + &[ + ("test::Action1", vec![Keystroke::parse("a").unwrap()]), + ("test::Action2", vec![Keystroke::parse("b").unwrap()]), + ("test::GlobalAction", vec![]), + ], + ); + }); }); // Produces a list of actions and key bindings diff --git a/crates/gpui/src/app/window.rs b/crates/gpui/src/app/window.rs index 49befafbec4bfca2fac1782f2d5c8d249b24a951..94c4df23850ef7076e5432822a73b7ac9d0bb66e 100644 --- a/crates/gpui/src/app/window.rs +++ b/crates/gpui/src/app/window.rs @@ -2,7 +2,7 @@ use crate::{ elements::AnyRootElement, geometry::rect::RectF, json::ToJson, - keymap_matcher::{Binding, Keystroke, MatchResult}, + keymap_matcher::{Binding, KeymapContext, Keystroke, MatchResult}, platform::{ self, Appearance, CursorStyle, Event, KeyDownEvent, KeyUpEvent, ModifiersChangedEvent, MouseButton, MouseMovedEvent, PromptLevel, WindowBounds, @@ -34,7 +34,7 @@ use std::{ use util::ResultExt; use uuid::Uuid; -use super::Reference; +use super::{Reference, ViewMetadata}; pub struct Window { pub(crate) root_view: Option, @@ -369,13 +369,13 @@ impl<'a> WindowContext<'a> { let mut contexts = Vec::new(); let mut handler_depth = None; for (i, view_id) in self.ancestors(view_id).enumerate() { - if let Some(view) = self.views.get(&(window_id, view_id)) { - if let Some(actions) = self.actions.get(&view.as_any().type_id()) { + if let Some(view_metadata) = self.views_metadata.get(&(window_id, view_id)) { + if let Some(actions) = self.actions.get(&view_metadata.type_id) { if actions.contains_key(&action.as_any().type_id()) { handler_depth = Some(i); } } - contexts.push(view.keymap_context(self)); + contexts.push(view_metadata.keymap_context.clone()); } } @@ -406,10 +406,9 @@ impl<'a> WindowContext<'a> { let mut contexts = Vec::new(); let mut handler_depths_by_action_type = HashMap::::default(); for (depth, view_id) in self.ancestors(view_id).enumerate() { - if let Some(view) = self.views.get(&(window_id, view_id)) { - contexts.push(view.keymap_context(self)); - let view_type = view.as_any().type_id(); - if let Some(actions) = self.actions.get(&view_type) { + if let Some(view_metadata) = self.views_metadata.get(&(window_id, view_id)) { + contexts.push(view_metadata.keymap_context.clone()); + if let Some(actions) = self.actions.get(&view_metadata.type_id) { handler_depths_by_action_type.extend( actions .keys() @@ -458,9 +457,9 @@ impl<'a> WindowContext<'a> { let dispatch_path = self .ancestors(focused_view_id) .filter_map(|view_id| { - self.views + self.views_metadata .get(&(window_id, view_id)) - .map(|view| (view_id, view.keymap_context(self))) + .map(|view| (view_id, view.keymap_context.clone())) }) .collect(); @@ -1177,6 +1176,15 @@ impl<'a> WindowContext<'a> { self.parents.insert((window_id, view_id), parent_id); let mut cx = ViewContext::mutable(self, view_id); let handle = if let Some(view) = build_view(&mut cx) { + let mut keymap_context = KeymapContext::default(); + view.update_keymap_context(&mut keymap_context, cx.app_context()); + self.views_metadata.insert( + (window_id, view_id), + ViewMetadata { + type_id: TypeId::of::(), + keymap_context, + }, + ); self.views.insert((window_id, view_id), Box::new(view)); self.window .invalidation diff --git a/crates/gpui/src/keymap_matcher/keymap_context.rs b/crates/gpui/src/keymap_matcher/keymap_context.rs index bbf6bfc14bad820cd95c1525c5b673f8b8c04dcc..b1a449edf3ed9e005a0b7a4d4711c7792b3c023c 100644 --- a/crates/gpui/src/keymap_matcher/keymap_context.rs +++ b/crates/gpui/src/keymap_matcher/keymap_context.rs @@ -17,6 +17,11 @@ impl KeymapContext { } } + pub fn clear(&mut self) { + self.set.clear(); + self.map.clear(); + } + pub fn extend(&mut self, other: &Self) { for v in &other.set { self.set.insert(v.clone()); diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index 62ffd417fe7b463e77f12804303fd01292c8a26d..01749ccf84d72f5cc5907bf66f7d9c75c4d3d06f 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -126,10 +126,9 @@ impl View for Picker { .into_any_named("picker") } - fn keymap_context(&self, _: &AppContext) -> KeymapContext { - let mut cx = Self::default_keymap_context(); - cx.add_identifier("menu"); - cx + fn update_keymap_context(&self, keymap: &mut KeymapContext, _: &AppContext) { + Self::reset_to_default_keymap_context(keymap); + keymap.add_identifier("menu"); } fn focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext) { diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 373417b167047ac80cd2d04aa8d7eb22068fa1df..ec80bd245aef9feaa68252414f1d732431b9fcf6 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -1316,10 +1316,9 @@ impl View for ProjectPanel { } } - fn keymap_context(&self, _: &AppContext) -> KeymapContext { - let mut cx = Self::default_keymap_context(); - cx.add_identifier("menu"); - cx + fn update_keymap_context(&self, keymap: &mut KeymapContext, _: &AppContext) { + Self::reset_to_default_keymap_context(keymap); + keymap.add_identifier("menu"); } } diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rs index 5e04fc982556cc638752cd0a7a4774a27c0d2654..3fcbf3988721a1282eb17672d46ef639d33ae1a0 100644 --- a/crates/terminal_view/src/terminal_view.rs +++ b/crates/terminal_view/src/terminal_view.rs @@ -446,11 +446,11 @@ impl View for TerminalView { }); } - fn keymap_context(&self, cx: &gpui::AppContext) -> KeymapContext { - let mut context = Self::default_keymap_context(); + fn update_keymap_context(&self, keymap: &mut KeymapContext, cx: &gpui::AppContext) { + Self::reset_to_default_keymap_context(keymap); let mode = self.terminal.read(cx).last_content.mode; - context.add_key( + keymap.add_key( "screen", if mode.contains(TermMode::ALT_SCREEN) { "alt" @@ -460,40 +460,40 @@ impl View for TerminalView { ); if mode.contains(TermMode::APP_CURSOR) { - context.add_identifier("DECCKM"); + keymap.add_identifier("DECCKM"); } if mode.contains(TermMode::APP_KEYPAD) { - context.add_identifier("DECPAM"); + keymap.add_identifier("DECPAM"); } else { - context.add_identifier("DECPNM"); + keymap.add_identifier("DECPNM"); } if mode.contains(TermMode::SHOW_CURSOR) { - context.add_identifier("DECTCEM"); + keymap.add_identifier("DECTCEM"); } if mode.contains(TermMode::LINE_WRAP) { - context.add_identifier("DECAWM"); + keymap.add_identifier("DECAWM"); } if mode.contains(TermMode::ORIGIN) { - context.add_identifier("DECOM"); + keymap.add_identifier("DECOM"); } if mode.contains(TermMode::INSERT) { - context.add_identifier("IRM"); + keymap.add_identifier("IRM"); } //LNM is apparently the name for this. https://vt100.net/docs/vt510-rm/LNM.html if mode.contains(TermMode::LINE_FEED_NEW_LINE) { - context.add_identifier("LNM"); + keymap.add_identifier("LNM"); } if mode.contains(TermMode::FOCUS_IN_OUT) { - context.add_identifier("report_focus"); + keymap.add_identifier("report_focus"); } if mode.contains(TermMode::ALTERNATE_SCROLL) { - context.add_identifier("alternate_scroll"); + keymap.add_identifier("alternate_scroll"); } if mode.contains(TermMode::BRACKETED_PASTE) { - context.add_identifier("bracketed_paste"); + keymap.add_identifier("bracketed_paste"); } if mode.intersects(TermMode::MOUSE_MODE) { - context.add_identifier("any_mouse_reporting"); + keymap.add_identifier("any_mouse_reporting"); } { let mouse_reporting = if mode.contains(TermMode::MOUSE_REPORT_CLICK) { @@ -505,7 +505,7 @@ impl View for TerminalView { } else { "off" }; - context.add_key("mouse_reporting", mouse_reporting); + keymap.add_key("mouse_reporting", mouse_reporting); } { let format = if mode.contains(TermMode::SGR_MOUSE) { @@ -515,9 +515,8 @@ impl View for TerminalView { } else { "normal" }; - context.add_key("mouse_format", format); + keymap.add_key("mouse_format", format); } - context } } diff --git a/crates/vim/src/vim.rs b/crates/vim/src/vim.rs index 7ce925944cede7325b9c2b6248250f895d12cc99..a0a12210ec36d73a6fd468331622231f2b7802c0 100644 --- a/crates/vim/src/vim.rs +++ b/crates/vim/src/vim.rs @@ -309,7 +309,7 @@ impl Vim { editor.set_input_enabled(!state.vim_controlled()); editor.selections.line_mode = matches!(state.mode, Mode::Visual { line: true }); let context_layer = state.keymap_context_layer(); - editor.set_keymap_context_layer::(context_layer); + editor.set_keymap_context_layer::(context_layer, cx); } else { Self::unhook_vim_settings(editor, cx); } @@ -321,7 +321,7 @@ impl Vim { editor.set_clip_at_line_ends(false, cx); editor.set_input_enabled(true); editor.selections.line_mode = false; - editor.remove_keymap_context_layer::(); + editor.remove_keymap_context_layer::(cx); } } diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 8bd42fed045ec80f51ea7b9432f588dcef6ca2a6..3d1e477941f2d40d5983b2f4cf2f4734b784260a 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -1831,12 +1831,11 @@ impl View for Pane { }); } - fn keymap_context(&self, _: &AppContext) -> KeymapContext { - let mut keymap = Self::default_keymap_context(); + fn update_keymap_context(&self, keymap: &mut KeymapContext, _: &AppContext) { + Self::reset_to_default_keymap_context(keymap); if self.docked.is_some() { keymap.add_identifier("docked"); } - keymap } } diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index bb2629862d3aeceb8c0e3c18895d355e6df6ce51..e1007043dcfc91d0f66204782b2b8cfa158ea76e 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -37,7 +37,6 @@ use gpui::{ vector::{vec2f, Vector2F}, }, impl_actions, - keymap_matcher::KeymapContext, platform::{ CursorStyle, MouseButton, PathPromptOptions, Platform, PromptLevel, WindowBounds, WindowOptions, @@ -2809,10 +2808,6 @@ impl View for Workspace { } } } - - fn keymap_context(&self, _: &AppContext) -> KeymapContext { - Self::default_keymap_context() - } } impl ViewId {