From e6604d1641cf8a12846be02e9be2251aed976714 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 21 Apr 2023 15:57:16 -0600 Subject: [PATCH] Fix missing actions in the command palette Previously, the workspace view was on the stack when we were computing the available actions, which excluded it. This is a stopgap. We should find a better solution ASAP. --- crates/command_palette/src/command_palette.rs | 16 ++++++++++------ crates/gpui/src/app/window.rs | 5 +++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs index 07c6de8663..1d9ac62c2c 100644 --- a/crates/command_palette/src/command_palette.rs +++ b/crates/command_palette/src/command_palette.rs @@ -2,7 +2,7 @@ use collections::CommandPaletteFilter; use fuzzy::{StringMatch, StringMatchCandidate}; use gpui::{ actions, elements::*, keymap_matcher::Keystroke, Action, AppContext, Element, MouseState, - ViewContext, + ViewContext, WindowContext, }; use picker::{Picker, PickerDelegate, PickerEvent}; use settings::Settings; @@ -45,15 +45,19 @@ fn toggle_command_palette(_: &mut Workspace, _: &Toggle, cx: &mut ViewContext>) -> Self { + pub fn new(focused_view_id: usize, cx: &mut WindowContext) -> Self { let actions = cx .available_actions(focused_view_id) .filter_map(|(name, action, bindings)| { diff --git a/crates/gpui/src/app/window.rs b/crates/gpui/src/app/window.rs index 12dc9a60c5..4a08d07aaa 100644 --- a/crates/gpui/src/app/window.rs +++ b/crates/gpui/src/app/window.rs @@ -444,6 +444,11 @@ impl<'a> WindowContext<'a> { .map(|action_type| (action_type, depth)), ); } + } else { + log::error!( + "view {} not found when computing available actions", + view_id + ); } }