Restore namespace parameter to `actions!`

Conrad Irwin created

This does not yet fix `derive(Action)`, but will conflict with a lot so
wanted to merge quickly.

Change summary

crates/activity_indicator2/src/activity_indicator.rs |   2 
crates/assistant2/src/assistant.rs                   |  23 
crates/auto_update2/src/auto_update.rs               |  11 
crates/client2/src/client2.rs                        |   2 
crates/collab_ui2/src/channel_view.rs                |   2 
crates/collab_ui2/src/chat_panel.rs                  |   2 
crates/collab_ui2/src/collab_panel.rs                |  19 
crates/collab_ui2/src/collab_panel/channel_modal.rs  |  11 
crates/collab_ui2/src/collab_titlebar_item.rs        |  13 
crates/collab_ui2/src/collab_ui.rs                   |   5 
crates/command_palette2/src/command_palette.rs       |   2 
crates/copilot2/src/copilot2.rs                      |  15 
crates/diagnostics2/src/diagnostics.rs               |   2 
crates/editor2/src/editor.rs                         | 233 +++++++------
crates/editor2/src/hover_popover.rs                  |   2 
crates/feedback2/src/feedback2.rs                    |  13 
crates/file_finder2/src/file_finder.rs               |   2 
crates/go_to_line2/src/go_to_line.rs                 |   2 
crates/gpui2/docs/key_dispatch.md                    |   2 
crates/gpui2/src/action.rs                           |  68 +++
crates/gpui2/src/interactive.rs                      |   2 
crates/gpui2/src/keymap/context.rs                   |   5 
crates/gpui2_macros/src/register_action.rs           |   2 
crates/install_cli2/src/install_cli2.rs              |   2 
crates/language_selector2/src/language_selector.rs   |   2 
crates/menu2/src/menu2.rs                            |  19 
crates/outline2/src/outline.rs                       |   2 
crates/project_panel2/src/project_panel.rs           |  37 +-
crates/recent_projects2/src/projects.rs              |   2 
crates/search2/src/buffer_search.rs                  |   2 
crates/search2/src/search.rs                         |  31 +
crates/settings2/src/keymap_file.rs                  |   6 
crates/storybook2/src/stories/focus.rs               |   2 
crates/terminal2/src/terminal2.rs                    |  17 
crates/terminal_view2/src/terminal_panel.rs          |   2 
crates/theme_selector2/src/theme_selector.rs         |   2 
crates/ui2/src/components/stories/context_menu.rs    |   2 
crates/ui2/src/components/stories/keybinding.rs      |   5 
crates/welcome2/src/base_keymap_picker.rs            |   2 
crates/workspace2/src/dock.rs                        |   2 
crates/workspace2/src/pane.rs                        |  32 +
crates/workspace2/src/workspace2.rs                  |  51 +-
crates/zed2/src/zed2.rs                              |  45 +-
43 files changed, 400 insertions(+), 305 deletions(-)

Detailed changes

crates/activity_indicator2/src/activity_indicator.rs 🔗

@@ -14,7 +14,7 @@ use ui::h_stack;
 use util::ResultExt;
 use workspace::{item::ItemHandle, StatusItemView, Workspace};
 
-actions!(ShowErrorMessage);
+actions!(activity_indicator, [ShowErrorMessage]);
 
 const DOWNLOAD_ICON: &str = "icons/download.svg";
 const WARNING_ICON: &str = "icons/warning.svg";

crates/assistant2/src/assistant.rs 🔗

@@ -19,16 +19,19 @@ use std::{cmp::Reverse, ffi::OsStr, path::PathBuf, sync::Arc};
 use util::paths::CONVERSATIONS_DIR;
 
 actions!(
-    NewConversation,
-    Assist,
-    Split,
-    CycleMessageRole,
-    QuoteSelection,
-    ToggleFocus,
-    ResetKey,
-    InlineAssist,
-    ToggleIncludeConversation,
-    ToggleRetrieveContext,
+    assistant,
+    [
+        NewConversation,
+        Assist,
+        Split,
+        CycleMessageRole,
+        QuoteSelection,
+        ToggleFocus,
+        ResetKey,
+        InlineAssist,
+        ToggleIncludeConversation,
+        ToggleRetrieveContext,
+    ]
 );
 
 #[derive(

crates/auto_update2/src/auto_update.rs 🔗

@@ -26,10 +26,13 @@ const POLL_INTERVAL: Duration = Duration::from_secs(60 * 60);
 
 //todo!(remove CheckThatAutoUpdaterWorks)
 actions!(
-    Check,
-    DismissErrorMessage,
-    ViewReleaseNotes,
-    CheckThatAutoUpdaterWorks
+    auto_update,
+    [
+        Check,
+        DismissErrorMessage,
+        ViewReleaseNotes,
+        CheckThatAutoUpdaterWorks
+    ]
 );
 
 #[derive(Serialize)]

crates/client2/src/client2.rs 🔗

@@ -70,7 +70,7 @@ pub const ZED_SECRET_CLIENT_TOKEN: &str = "618033988749894";
 pub const INITIAL_RECONNECTION_DELAY: Duration = Duration::from_millis(100);
 pub const CONNECTION_TIMEOUT: Duration = Duration::from_secs(5);
 
-actions!(SignIn, SignOut, Reconnect);
+actions!(client, [SignIn, SignOut, Reconnect]);
 
 pub fn init_settings(cx: &mut AppContext) {
     TelemetrySettings::register(cx);

crates/collab_ui2/src/channel_view.rs 🔗

@@ -26,7 +26,7 @@ use workspace::{
     ItemNavHistory, Pane, SaveIntent, ViewId, Workspace, WorkspaceId,
 };
 
-actions!(Deploy);
+actions!(collab, [Deploy]);
 
 pub fn init(cx: &mut AppContext) {
     register_followable_item::<ChannelView>(cx)

crates/collab_ui2/src/chat_panel.rs 🔗

@@ -75,7 +75,7 @@ pub enum Event {
     Dismissed,
 }
 
-actions!(ToggleFocus);
+actions!(chat_panel, [ToggleFocus]);
 
 impl ChatPanel {
     pub fn new(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) -> View<Self> {

crates/collab_ui2/src/collab_panel.rs 🔗

@@ -123,14 +123,17 @@ pub struct OpenChannelNotes {
 // }
 
 actions!(
-    ToggleFocus,
-    Remove,
-    Secondary,
-    CollapseSelectedChannel,
-    ExpandSelectedChannel,
-    StartMoveChannel,
-    MoveSelected,
-    InsertSpace,
+    collab_panel,
+    [
+        ToggleFocus,
+        Remove,
+        Secondary,
+        CollapseSelectedChannel,
+        ExpandSelectedChannel,
+        StartMoveChannel,
+        MoveSelected,
+        InsertSpace,
+    ]
 );
 
 // impl_actions!(

crates/collab_ui2/src/collab_panel/channel_modal.rs 🔗

@@ -16,10 +16,13 @@ use util::TryFutureExt;
 use workspace::ModalView;
 
 actions!(
-    SelectNextControl,
-    ToggleMode,
-    ToggleMemberAdmin,
-    RemoveMember
+    channel_modal,
+    [
+        SelectNextControl,
+        ToggleMode,
+        ToggleMemberAdmin,
+        RemoveMember
+    ]
 );
 
 // pub fn init(cx: &mut AppContext) {

crates/collab_ui2/src/collab_titlebar_item.rs 🔗

@@ -20,11 +20,14 @@ const MAX_PROJECT_NAME_LENGTH: usize = 40;
 const MAX_BRANCH_NAME_LENGTH: usize = 40;
 
 actions!(
-    ShareProject,
-    UnshareProject,
-    ToggleUserMenu,
-    ToggleProjectMenu,
-    SwitchBranch
+    collab,
+    [
+        ShareProject,
+        UnshareProject,
+        ToggleUserMenu,
+        ToggleProjectMenu,
+        SwitchBranch
+    ]
 );
 
 pub fn init(cx: &mut AppContext) {

crates/collab_ui2/src/collab_ui.rs 🔗

@@ -24,7 +24,10 @@ use settings::Settings;
 use util::ResultExt;
 use workspace::AppState;
 
-actions!(ToggleScreenSharing, ToggleMute, ToggleDeafen, LeaveCall);
+actions!(
+    collab,
+    [ToggleScreenSharing, ToggleMute, ToggleDeafen, LeaveCall]
+);
 
 pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
     CollaborationPanelSettings::register(cx);

crates/command_palette2/src/command_palette.rs 🔗

@@ -19,7 +19,7 @@ use util::{
 use workspace::{ModalView, Workspace};
 use zed_actions::OpenZedURL;
 
-actions!(Toggle);
+actions!(command_palette, [Toggle]);
 
 pub fn init(cx: &mut AppContext) {
     cx.set_global(HitCounts::default());

crates/copilot2/src/copilot2.rs 🔗

@@ -34,12 +34,15 @@ use util::{
 };
 
 actions!(
-    Suggest,
-    NextSuggestion,
-    PreviousSuggestion,
-    Reinstall,
-    SignIn,
-    SignOut
+    copilot,
+    [
+        Suggest,
+        NextSuggestion,
+        PreviousSuggestion,
+        Reinstall,
+        SignIn,
+        SignOut
+    ]
 );
 
 pub fn init(

crates/diagnostics2/src/diagnostics.rs 🔗

@@ -43,7 +43,7 @@ use workspace::{
     ItemNavHistory, Pane, ToolbarItemLocation, Workspace,
 };
 
-actions!(Deploy, ToggleWarnings);
+actions!(diagnostics, [Deploy, ToggleWarnings]);
 
 const CONTEXT_LINE_COUNT: u32 = 1;
 

crates/editor2/src/editor.rs 🔗

@@ -277,121 +277,124 @@ impl InlayId {
 }
 
 actions!(
-    AddSelectionAbove,
-    AddSelectionBelow,
-    Backspace,
-    Cancel,
-    ConfirmRename,
-    ContextMenuFirst,
-    ContextMenuLast,
-    ContextMenuNext,
-    ContextMenuPrev,
-    ConvertToKebabCase,
-    ConvertToLowerCamelCase,
-    ConvertToLowerCase,
-    ConvertToSnakeCase,
-    ConvertToTitleCase,
-    ConvertToUpperCamelCase,
-    ConvertToUpperCase,
-    Copy,
-    CopyHighlightJson,
-    CopyPath,
-    CopyRelativePath,
-    Cut,
-    CutToEndOfLine,
-    Delete,
-    DeleteLine,
-    DeleteToBeginningOfLine,
-    DeleteToEndOfLine,
-    DeleteToNextSubwordEnd,
-    DeleteToNextWordEnd,
-    DeleteToPreviousSubwordStart,
-    DeleteToPreviousWordStart,
-    DuplicateLine,
-    FindAllReferences,
-    Fold,
-    FoldSelectedRanges,
-    Format,
-    GoToDefinition,
-    GoToDefinitionSplit,
-    GoToDiagnostic,
-    GoToHunk,
-    GoToPrevDiagnostic,
-    GoToPrevHunk,
-    GoToTypeDefinition,
-    GoToTypeDefinitionSplit,
-    HalfPageDown,
-    HalfPageUp,
-    Hover,
-    Indent,
-    JoinLines,
-    LineDown,
-    LineUp,
-    MoveDown,
-    MoveLeft,
-    MoveLineDown,
-    MoveLineUp,
-    MoveRight,
-    MoveToBeginning,
-    MoveToBeginningOfLine,
-    MoveToEnclosingBracket,
-    MoveToEnd,
-    MoveToEndOfLine,
-    MoveToEndOfParagraph,
-    MoveToNextSubwordEnd,
-    MoveToNextWordEnd,
-    MoveToPreviousSubwordStart,
-    MoveToPreviousWordStart,
-    MoveToStartOfParagraph,
-    MoveUp,
-    Newline,
-    NewlineAbove,
-    NewlineBelow,
-    NextScreen,
-    OpenExcerpts,
-    Outdent,
-    PageDown,
-    PageUp,
-    Paste,
-    Redo,
-    RedoSelection,
-    Rename,
-    RestartLanguageServer,
-    RevealInFinder,
-    ReverseLines,
-    ScrollCursorBottom,
-    ScrollCursorCenter,
-    ScrollCursorTop,
-    SelectAll,
-    SelectDown,
-    SelectLargerSyntaxNode,
-    SelectLeft,
-    SelectLine,
-    SelectRight,
-    SelectSmallerSyntaxNode,
-    SelectToBeginning,
-    SelectToEnd,
-    SelectToEndOfParagraph,
-    SelectToNextSubwordEnd,
-    SelectToNextWordEnd,
-    SelectToPreviousSubwordStart,
-    SelectToPreviousWordStart,
-    SelectToStartOfParagraph,
-    SelectUp,
-    ShowCharacterPalette,
-    ShowCompletions,
-    ShuffleLines,
-    SortLinesCaseInsensitive,
-    SortLinesCaseSensitive,
-    SplitSelectionIntoLines,
-    Tab,
-    TabPrev,
-    ToggleInlayHints,
-    ToggleSoftWrap,
-    Transpose,
-    Undo,
-    UndoSelection,
-    UnfoldLines,
+    editor,
+    [
+        AddSelectionAbove,
+        AddSelectionBelow,
+        Backspace,
+        Cancel,
+        ConfirmRename,
+        ContextMenuFirst,
+        ContextMenuLast,
+        ContextMenuNext,
+        ContextMenuPrev,
+        ConvertToKebabCase,
+        ConvertToLowerCamelCase,
+        ConvertToLowerCase,
+        ConvertToSnakeCase,
+        ConvertToTitleCase,
+        ConvertToUpperCamelCase,
+        ConvertToUpperCase,
+        Copy,
+        CopyHighlightJson,
+        CopyPath,
+        CopyRelativePath,
+        Cut,
+        CutToEndOfLine,
+        Delete,
+        DeleteLine,
+        DeleteToBeginningOfLine,
+        DeleteToEndOfLine,
+        DeleteToNextSubwordEnd,
+        DeleteToNextWordEnd,
+        DeleteToPreviousSubwordStart,
+        DeleteToPreviousWordStart,
+        DuplicateLine,
+        FindAllReferences,
+        Fold,
+        FoldSelectedRanges,
+        Format,
+        GoToDefinition,
+        GoToDefinitionSplit,
+        GoToDiagnostic,
+        GoToHunk,
+        GoToPrevDiagnostic,
+        GoToPrevHunk,
+        GoToTypeDefinition,
+        GoToTypeDefinitionSplit,
+        HalfPageDown,
+        HalfPageUp,
+        Hover,
+        Indent,
+        JoinLines,
+        LineDown,
+        LineUp,
+        MoveDown,
+        MoveLeft,
+        MoveLineDown,
+        MoveLineUp,
+        MoveRight,
+        MoveToBeginning,
+        MoveToBeginningOfLine,
+        MoveToEnclosingBracket,
+        MoveToEnd,
+        MoveToEndOfLine,
+        MoveToEndOfParagraph,
+        MoveToNextSubwordEnd,
+        MoveToNextWordEnd,
+        MoveToPreviousSubwordStart,
+        MoveToPreviousWordStart,
+        MoveToStartOfParagraph,
+        MoveUp,
+        Newline,
+        NewlineAbove,
+        NewlineBelow,
+        NextScreen,
+        OpenExcerpts,
+        Outdent,
+        PageDown,
+        PageUp,
+        Paste,
+        Redo,
+        RedoSelection,
+        Rename,
+        RestartLanguageServer,
+        RevealInFinder,
+        ReverseLines,
+        ScrollCursorBottom,
+        ScrollCursorCenter,
+        ScrollCursorTop,
+        SelectAll,
+        SelectDown,
+        SelectLargerSyntaxNode,
+        SelectLeft,
+        SelectLine,
+        SelectRight,
+        SelectSmallerSyntaxNode,
+        SelectToBeginning,
+        SelectToEnd,
+        SelectToEndOfParagraph,
+        SelectToNextSubwordEnd,
+        SelectToNextWordEnd,
+        SelectToPreviousSubwordStart,
+        SelectToPreviousWordStart,
+        SelectToStartOfParagraph,
+        SelectUp,
+        ShowCharacterPalette,
+        ShowCompletions,
+        ShuffleLines,
+        SortLinesCaseInsensitive,
+        SortLinesCaseSensitive,
+        SplitSelectionIntoLines,
+        Tab,
+        TabPrev,
+        ToggleInlayHints,
+        ToggleSoftWrap,
+        Transpose,
+        Undo,
+        UndoSelection,
+        UnfoldLines,
+    ]
 );
 
 enum DocumentHighlightRead {}

crates/editor2/src/hover_popover.rs 🔗

@@ -26,7 +26,7 @@ pub const MIN_POPOVER_CHARACTER_WIDTH: f32 = 20.;
 pub const MIN_POPOVER_LINE_HEIGHT: Pixels = px(4.);
 pub const HOVER_POPOVER_GAP: Pixels = px(10.);
 
-actions!(Hover);
+actions!(editor, [Hover]);
 
 /// Bindable action which uses the most recent selection head to trigger a hover
 pub fn hover(editor: &mut Editor, _: &Hover, cx: &mut ViewContext<Editor>) {

crates/feedback2/src/feedback2.rs 🔗

@@ -5,15 +5,18 @@ use workspace::Workspace;
 pub mod deploy_feedback_button;
 pub mod feedback_modal;
 
-actions!(GiveFeedback, SubmitFeedback);
+actions!(feedback, [GiveFeedback, SubmitFeedback]);
 
 mod system_specs;
 
 actions!(
-    CopySystemSpecsIntoClipboard,
-    FileBugReport,
-    RequestFeature,
-    OpenZedCommunityRepo
+    zed,
+    [
+        CopySystemSpecsIntoClipboard,
+        FileBugReport,
+        RequestFeature,
+        OpenZedCommunityRepo
+    ]
 );
 
 pub fn init(cx: &mut AppContext) {

crates/file_finder2/src/file_finder.rs 🔗

@@ -19,7 +19,7 @@ use ui::{prelude::*, HighlightedLabel, ListItem};
 use util::{paths::PathLikeWithPosition, post_inc, ResultExt};
 use workspace::{ModalView, Workspace};
 
-actions!(Toggle);
+actions!(file_finder, [Toggle]);
 
 impl ModalView for FileFinder {}
 

crates/go_to_line2/src/go_to_line.rs 🔗

@@ -10,7 +10,7 @@ use ui::{h_stack, prelude::*, v_stack, Label};
 use util::paths::FILE_ROW_COLUMN_DELIMITER;
 use workspace::ModalView;
 
-actions!(Toggle);
+actions!(go_to_line, [Toggle]);
 
 pub fn init(cx: &mut AppContext) {
     cx.observe_new_views(GoToLine::register).detach();

crates/gpui2/docs/key_dispatch.md 🔗

@@ -22,7 +22,7 @@ Actions are frequently unit structs, for which we have a macro. The above could
 
 ```rust
 mod menu {
-    actions!(MoveUp, MoveDown);
+    actions!(gpui, [MoveUp, MoveDown]);
 }
 ```
 

crates/gpui2/src/action.rs 🔗

@@ -158,17 +158,65 @@ impl ActionRegistry {
 /// To use more complex data types as actions, annotate your type with the #[action] macro.
 #[macro_export]
 macro_rules! actions {
-    () => {};
-
-    ( $name:ident ) => {
-        #[derive(::std::cmp::PartialEq, ::std::clone::Clone, ::std::default::Default, gpui::serde_derive::Deserialize, gpui::Action)]
-        #[serde(crate = "gpui::serde")]
-        pub struct $name;
+    ($namespace:path, [ $($name:ident),* $(,)? ]) => {
+        $(
+            #[derive(::std::cmp::PartialEq, ::std::clone::Clone, ::std::default::Default, gpui::serde_derive::Deserialize)]
+            #[serde(crate = "gpui::serde")]
+            #[gpui::register_action]
+            pub struct $name;
+
+            gpui::__impl_action!($namespace, $name,
+                fn build(_: gpui::serde_json::Value) -> gpui::Result<::std::boxed::Box<dyn gpui::Action>> {
+                    Ok(Box::new(Self))
+                }
+            );
+        )*
     };
+}
 
-    ( $name:ident, $($rest:tt)* ) => {
-        actions!($name);
-        actions!($($rest)*);
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __impl_action {
+    ($namespace:path, $name:ident, $build:item) => {
+        impl gpui::Action for $name {
+            fn name(&self) -> &'static str
+            {
+                concat!(
+                    stringify!($namespace),
+                    "::",
+                    stringify!($name),
+                )
+            }
+
+            // todo!() why is this needed in addition to name?
+            fn debug_name() -> &'static str
+            where
+                Self: ::std::marker::Sized
+            {
+                concat!(
+                    stringify!($namespace),
+                    "::",
+                    stringify!($name),
+                )
+            }
+
+            $build
+
+            fn partial_eq(&self, action: &dyn gpui::Action) -> bool {
+                action
+                    .as_any()
+                    .downcast_ref::<Self>()
+                    .map_or(false, |a| self == a)
+            }
+
+            fn boxed_clone(&self) ->  std::boxed::Box<dyn gpui::Action> {
+                ::std::boxed::Box::new(self.clone())
+            }
+
+            fn as_any(&self) -> &dyn ::std::any::Any {
+                self
+            }
+        }
     };
 }
 
@@ -186,5 +234,5 @@ pub fn remove_the_2(action_name: &str) -> String {
 mod no_action {
     use crate as gpui;
 
-    actions!(NoAction);
+    actions!(zed, [NoAction]);
 }

crates/gpui2/src/interactive.rs 🔗

@@ -302,7 +302,7 @@ mod test {
         focus_handle: FocusHandle,
     }
 
-    actions!(TestAction);
+    actions!(test, [TestAction]);
 
     impl Render for TestView {
         type Element = Stateful<Div>;

crates/gpui2/src/keymap/context.rs 🔗

@@ -293,11 +293,13 @@ mod tests {
     #[test]
     fn test_actions_definition() {
         {
-            actions!(A, B, C, D, E, F, G);
+            actions!(test, [A, B, C, D, E, F, G]);
         }
 
         {
             actions!(
+                test,
+                [
                 A,
                 B,
                 C,
@@ -305,6 +307,7 @@ mod tests {
                 E,
                 F,
                 G, // Don't wrap, test the trailing comma
+            ]
             );
         }
     }

crates/gpui2_macros/src/register_action.rs 🔗

@@ -78,7 +78,7 @@ pub(crate) fn register_action(type_name: &Ident) -> proc_macro2::TokenStream {
         #[doc(hidden)]
         fn #action_builder_fn_name() -> gpui::ActionData {
             gpui::ActionData {
-                name: ::std::any::type_name::<#type_name>(),
+                name: <#type_name as gpui::Action>::debug_name(),
                 type_id: ::std::any::TypeId::of::<#type_name>(),
                 build: <#type_name as gpui::Action>::build,
             }

crates/install_cli2/src/install_cli2.rs 🔗

@@ -3,7 +3,7 @@ use gpui::{actions, AsyncAppContext};
 use std::path::Path;
 use util::ResultExt;
 
-actions!(Install);
+actions!(cli, [Install]);
 
 pub async fn install_cli(cx: &AsyncAppContext) -> Result<()> {
     let cli_path = cx.update(|cx| cx.path_for_auxiliary_executable("cli"))??;

crates/language_selector2/src/language_selector.rs 🔗

@@ -16,7 +16,7 @@ use ui::{prelude::*, HighlightedLabel, ListItem};
 use util::ResultExt;
 use workspace::{ModalView, Workspace};
 
-actions!(Toggle);
+actions!(language_selector, [Toggle]);
 
 pub fn init(cx: &mut AppContext) {
     cx.observe_new_views(LanguageSelector::register).detach();

crates/menu2/src/menu2.rs 🔗

@@ -10,12 +10,15 @@ use gpui::actions;
 pub fn init() {}
 
 actions!(
-    Cancel,
-    Confirm,
-    SecondaryConfirm,
-    SelectPrev,
-    SelectNext,
-    SelectFirst,
-    SelectLast,
-    ShowContextMenu
+    menu,
+    [
+        Cancel,
+        Confirm,
+        SecondaryConfirm,
+        SelectPrev,
+        SelectNext,
+        SelectFirst,
+        SelectLast,
+        ShowContextMenu
+    ]
 );

crates/outline2/src/outline.rs 🔗

@@ -22,7 +22,7 @@ use ui::{prelude::*, ListItem};
 use util::ResultExt;
 use workspace::{ModalView, Workspace};
 
-actions!(Toggle);
+actions!(outline, [Toggle]);
 
 pub fn init(cx: &mut AppContext) {
     cx.observe_new_views(OutlineView::register).detach();

crates/project_panel2/src/project_panel.rs 🔗

@@ -103,23 +103,26 @@ pub struct EntryDetails {
 }
 
 actions!(
-    ExpandSelectedEntry,
-    CollapseSelectedEntry,
-    CollapseAllEntries,
-    NewDirectory,
-    NewFile,
-    Copy,
-    CopyPath,
-    CopyRelativePath,
-    RevealInFinder,
-    OpenInTerminal,
-    Cut,
-    Paste,
-    Delete,
-    Rename,
-    Open,
-    ToggleFocus,
-    NewSearchInDirectory,
+    project_panel,
+    [
+        ExpandSelectedEntry,
+        CollapseSelectedEntry,
+        CollapseAllEntries,
+        NewDirectory,
+        NewFile,
+        Copy,
+        CopyPath,
+        CopyRelativePath,
+        RevealInFinder,
+        OpenInTerminal,
+        Cut,
+        Paste,
+        Delete,
+        Rename,
+        Open,
+        ToggleFocus,
+        NewSearchInDirectory,
+    ]
 );
 
 pub fn init_settings(cx: &mut AppContext) {

crates/search2/src/buffer_search.rs 🔗

@@ -31,7 +31,7 @@ pub struct Deploy {
     pub focus: bool,
 }
 
-actions!(Dismiss, FocusEditor);
+actions!(buffer_search, [Dismiss, FocusEditor]);
 
 pub enum Event {
     UpdateLocation,

crates/search2/src/search.rs 🔗

@@ -22,20 +22,23 @@ pub fn init(cx: &mut AppContext) {
 }
 
 actions!(
-    CycleMode,
-    ToggleWholeWord,
-    ToggleCaseSensitive,
-    ToggleReplace,
-    SelectNextMatch,
-    SelectPrevMatch,
-    SelectAllMatches,
-    NextHistoryQuery,
-    PreviousHistoryQuery,
-    ActivateTextMode,
-    ActivateSemanticMode,
-    ActivateRegexMode,
-    ReplaceAll,
-    ReplaceNext,
+    search,
+    [
+        CycleMode,
+        ToggleWholeWord,
+        ToggleCaseSensitive,
+        ToggleReplace,
+        SelectNextMatch,
+        SelectPrevMatch,
+        SelectAllMatches,
+        NextHistoryQuery,
+        PreviousHistoryQuery,
+        ActivateTextMode,
+        ActivateSemanticMode,
+        ActivateRegexMode,
+        ReplaceAll,
+        ReplaceNext,
+    ]
 );
 
 bitflags! {

crates/settings2/src/keymap_file.rs 🔗

@@ -1,7 +1,7 @@
 use crate::{settings_store::parse_json_with_comments, SettingsAssets};
 use anyhow::{anyhow, Context, Result};
 use collections::BTreeMap;
-use gpui::{actions, Action, AppContext, KeyBinding, SharedString};
+use gpui::{Action, AppContext, KeyBinding, SharedString};
 use schemars::{
     gen::{SchemaGenerator, SchemaSettings},
     schema::{InstanceType, Schema, SchemaObject, SingleOrVec, SubschemaValidation},
@@ -137,10 +137,8 @@ impl KeymapFile {
     }
 }
 
-actions!(NoAction);
-
 fn no_action() -> Box<dyn gpui::Action> {
-    NoAction.boxed_clone()
+    gpui::NoAction.boxed_clone()
 }
 
 #[cfg(test)]

crates/storybook2/src/stories/focus.rs 🔗

@@ -4,7 +4,7 @@ use gpui::{
 };
 use ui::prelude::*;
 
-actions!(ActionA, ActionB, ActionC);
+actions!(focus, [ActionA, ActionB, ActionC]);
 
 pub struct FocusStory {
     child_1_focus: FocusHandle,

crates/terminal2/src/terminal2.rs 🔗

@@ -59,13 +59,16 @@ use crate::mappings::{colors::to_alac_rgb, keys::to_esc_str};
 use lazy_static::lazy_static;
 
 actions!(
-    Clear,
-    Copy,
-    Paste,
-    ShowCharacterPalette,
-    SearchTest,
-    SendText,
-    SendKeystroke,
+    terminal,
+    [
+        Clear,
+        Copy,
+        Paste,
+        ShowCharacterPalette,
+        SearchTest,
+        SendText,
+        SendKeystroke,
+    ]
 );
 
 ///Scrolling is unbearably sluggish by default. Alacritty supports a configurable

crates/terminal_view2/src/terminal_panel.rs 🔗

@@ -24,7 +24,7 @@ use anyhow::Result;
 
 const TERMINAL_PANEL_KEY: &'static str = "TerminalPanel";
 
-actions!(ToggleFocus);
+actions!(terminal_view, [ToggleFocus]);
 
 pub fn init(cx: &mut AppContext) {
     cx.observe_new_views(

crates/theme_selector2/src/theme_selector.rs 🔗

@@ -13,7 +13,7 @@ use ui::{prelude::*, v_stack, ListItem};
 use util::ResultExt;
 use workspace::{ui::HighlightedLabel, ModalView, Workspace};
 
-actions!(Toggle, Reload);
+actions!(theme_selector, [Toggle, Reload]);
 
 pub fn init(cx: &mut AppContext) {
     cx.observe_new_views(

crates/ui2/src/components/stories/context_menu.rs 🔗

@@ -4,7 +4,7 @@ use story::Story;
 use crate::prelude::*;
 use crate::{right_click_menu, ContextMenu, Label};
 
-actions!(PrintCurrentDate, PrintBestFood);
+actions!(context_menu, [PrintCurrentDate, PrintBestFood]);
 
 fn build_menu(cx: &mut WindowContext, header: impl Into<SharedString>) -> View<ContextMenu> {
     ContextMenu::build(cx, |menu, _| {

crates/ui2/src/components/stories/keybinding.rs 🔗

@@ -1,4 +1,5 @@
-use gpui::{actions, Div, Render};
+use gpui::NoAction;
+use gpui::{Div, Render};
 use itertools::Itertools;
 use story::Story;
 
@@ -7,8 +8,6 @@ use crate::KeyBinding;
 
 pub struct KeybindingStory;
 
-actions!(NoAction);
-
 pub fn binding(key: &str) -> gpui::KeyBinding {
     gpui::KeyBinding::new(key, NoAction {}, None)
 }

crates/welcome2/src/base_keymap_picker.rs 🔗

@@ -12,7 +12,7 @@ use ui::{prelude::*, ListItem};
 use util::ResultExt;
 use workspace::{ui::HighlightedLabel, ModalView, Workspace};
 
-actions!(ToggleBaseKeymapSelector);
+actions!(welcome, [ToggleBaseKeymapSelector]);
 
 pub fn init(cx: &mut AppContext) {
     cx.observe_new_views(|workspace: &mut Workspace, _cx| {

crates/workspace2/src/dock.rs 🔗

@@ -770,7 +770,7 @@ pub mod test {
         pub focus_handle: FocusHandle,
         pub size: f32,
     }
-    actions!(ToggleTestPanel);
+    actions!(test, [ToggleTestPanel]);
 
     impl EventEmitter<PanelEvent> for TestPanel {}
 

crates/workspace2/src/pane.rs 🔗

@@ -87,22 +87,24 @@ pub struct CloseAllItems {
     pub save_intent: Option<SaveIntent>,
 }
 
-// todo!(These used to be under pane::{Action}. Are they now workspace::pane::{Action}?)
 actions!(
-    ActivatePrevItem,
-    ActivateNextItem,
-    ActivateLastItem,
-    CloseInactiveItems,
-    CloseCleanItems,
-    CloseItemsToTheLeft,
-    CloseItemsToTheRight,
-    GoBack,
-    GoForward,
-    ReopenClosedItem,
-    SplitLeft,
-    SplitUp,
-    SplitRight,
-    SplitDown,
+    pane,
+    [
+        ActivatePrevItem,
+        ActivateNextItem,
+        ActivateLastItem,
+        CloseInactiveItems,
+        CloseCleanItems,
+        CloseItemsToTheLeft,
+        CloseItemsToTheRight,
+        GoBack,
+        GoForward,
+        ReopenClosedItem,
+        SplitLeft,
+        SplitUp,
+        SplitRight,
+        SplitDown,
+    ]
 );
 
 const MAX_NAVIGATION_HISTORY_LEN: usize = 1024;

crates/workspace2/src/workspace2.rs 🔗

@@ -91,30 +91,33 @@ lazy_static! {
 pub struct RemoveWorktreeFromProject(pub WorktreeId);
 
 actions!(
-    Open,
-    NewFile,
-    NewWindow,
-    CloseWindow,
-    CloseInactiveTabsAndPanes,
-    AddFolderToProject,
-    Unfollow,
-    SaveAs,
-    ReloadActiveItem,
-    ActivatePreviousPane,
-    ActivateNextPane,
-    FollowNextCollaborator,
-    NewTerminal,
-    NewCenterTerminal,
-    ToggleTerminalFocus,
-    NewSearch,
-    Feedback,
-    Restart,
-    Welcome,
-    ToggleZoom,
-    ToggleLeftDock,
-    ToggleRightDock,
-    ToggleBottomDock,
-    CloseAllDocks,
+    workspace,
+    [
+        Open,
+        NewFile,
+        NewWindow,
+        CloseWindow,
+        CloseInactiveTabsAndPanes,
+        AddFolderToProject,
+        Unfollow,
+        SaveAs,
+        ReloadActiveItem,
+        ActivatePreviousPane,
+        ActivateNextPane,
+        FollowNextCollaborator,
+        NewTerminal,
+        NewCenterTerminal,
+        ToggleTerminalFocus,
+        NewSearch,
+        Feedback,
+        Restart,
+        Welcome,
+        ToggleZoom,
+        ToggleLeftDock,
+        ToggleRightDock,
+        ToggleBottomDock,
+        CloseAllDocks,
+    ]
 );
 
 #[derive(Clone, PartialEq)]

crates/zed2/src/zed2.rs 🔗

@@ -43,27 +43,30 @@ use workspace::{
 use zed_actions::{OpenBrowser, OpenZedURL};
 
 actions!(
-    About,
-    DebugElements,
-    DecreaseBufferFontSize,
-    Hide,
-    HideOthers,
-    IncreaseBufferFontSize,
-    Minimize,
-    OpenDefaultKeymap,
-    OpenDefaultSettings,
-    OpenKeymap,
-    OpenLicenses,
-    OpenLocalSettings,
-    OpenLog,
-    OpenSettings,
-    OpenTelemetryLog,
-    Quit,
-    ResetBufferFontSize,
-    ResetDatabase,
-    ShowAll,
-    ToggleFullScreen,
-    Zoom,
+    zed,
+    [
+        About,
+        DebugElements,
+        DecreaseBufferFontSize,
+        Hide,
+        HideOthers,
+        IncreaseBufferFontSize,
+        Minimize,
+        OpenDefaultKeymap,
+        OpenDefaultSettings,
+        OpenKeymap,
+        OpenLicenses,
+        OpenLocalSettings,
+        OpenLog,
+        OpenSettings,
+        OpenTelemetryLog,
+        Quit,
+        ResetBufferFontSize,
+        ResetDatabase,
+        ShowAll,
+        ToggleFullScreen,
+        Zoom,
+    ]
 );
 
 pub fn build_window_options(