Skip to main content

Action

Derive Macro Action 

Source
#[derive(Action)]
{
    // Attributes available to this derive:
    #[action]
}
Expand description

Derives gpui::Action for a type and registers it with the runtime.

Use it for any type that a keymap or the command palette should be able to name. The type must implement Clone and PartialEq. Unless the type is a unit struct or no_json is set, it must also implement serde::Deserialize and schemars::JsonSchema, so that keymaps can build it from JSON.

The doc comment on the type becomes the action’s documentation. The #[action(...)] attribute sets the name, namespace, aliases and deprecation. See gpui::Action for the full attribute reference.

Use register_action! if you implement gpui::Action by hand.