From 6cd4dbdea11bd124241fd6de106535ac8e73df55 Mon Sep 17 00:00:00 2001 From: Ben Kunkle Date: Wed, 2 Jul 2025 20:14:33 -0500 Subject: [PATCH] gpui: Store action documentation (#33809) Closes #ISSUE Adds a new `documentation` method to actions, that is extracted from doc comments when using the `actions!` or derive macros. Additionally, this PR adds doc comments to as many action definitions in Zed as possible. Release Notes: - N/A *or* Added/Fixed/Improved ... --- .../src/activity_indicator.rs | 8 +- crates/agent_ui/src/agent_ui.rs | 35 +++ .../agent_ui/src/language_model_selector.rs | 1 + crates/agent_ui/src/text_thread_editor.rs | 8 + crates/auto_update/src/auto_update.rs | 12 +- crates/auto_update_ui/src/auto_update_ui.rs | 8 +- crates/client/src/client.rs | 12 +- crates/collab_ui/src/channel_view.rs | 8 +- crates/collab_ui/src/chat_panel.rs | 8 +- crates/collab_ui/src/collab_panel.rs | 10 + .../src/collab_panel/channel_modal.rs | 4 + crates/collab_ui/src/notification_panel.rs | 8 +- crates/copilot/src/copilot.rs | 6 + crates/debugger_tools/src/dap_log.rs | 8 +- crates/debugger_ui/src/debugger_ui.rs | 33 ++- .../src/session/running/breakpoint_list.rs | 7 +- .../src/session/running/console.rs | 8 +- .../src/session/running/variable_list.rs | 7 + crates/diagnostics/src/diagnostics.rs | 9 +- crates/editor/src/actions.rs | 249 +++++++++++++++++- crates/extension_host/src/extension_host.rs | 8 +- crates/extensions_ui/src/extensions_ui.rs | 8 +- crates/feedback/src/feedback.rs | 4 + crates/file_finder/src/file_finder.rs | 9 +- crates/git/src/git.rs | 26 ++ crates/git_ui/src/git_panel.rs | 6 + crates/git_ui/src/git_ui.rs | 8 +- crates/git_ui/src/project_diff.rs | 10 +- crates/gpui/src/action.rs | 11 + crates/gpui_macros/src/derive_action.rs | 28 ++ crates/gpui_macros/src/register_action.rs | 1 + .../src/inline_completion_button.rs | 8 +- crates/install_cli/src/install_cli.rs | 10 +- crates/journal/src/journal.rs | 8 +- .../src/language_selector.rs | 8 +- crates/language_tools/src/key_context_view.rs | 8 +- crates/language_tools/src/lsp_log.rs | 8 +- crates/language_tools/src/lsp_tool.rs | 8 +- crates/language_tools/src/syntax_tree_view.rs | 8 +- crates/markdown/src/markdown.rs | 10 +- .../markdown_preview/src/markdown_preview.rs | 5 + crates/menu/src/menu.rs | 8 + crates/outline_panel/src/outline_panel.rs | 13 +- crates/panel/src/panel.rs | 10 +- crates/picker/src/picker.rs | 8 +- crates/project/src/context_server_store.rs | 8 +- crates/project_panel/src/project_panel.rs | 29 ++ crates/repl/src/notebook/notebook_ui.rs | 7 + crates/repl/src/repl_sessions_ui.rs | 8 + crates/rules_library/src/rules_library.rs | 11 +- crates/search/src/buffer_search.rs | 13 +- crates/search/src/project_search.rs | 11 +- crates/search/src/search.rs | 16 ++ crates/settings_ui/src/keybindings.rs | 20 +- crates/settings_ui/src/settings_ui.rs | 10 +- crates/snippets_ui/src/snippets_ui.rs | 10 +- crates/supermaven/src/supermaven.rs | 8 +- crates/svg_preview/src/svg_preview.rs | 9 +- crates/tab_switcher/src/tab_switcher.rs | 11 +- crates/terminal/src/terminal.rs | 18 ++ crates/terminal_view/src/terminal_panel.rs | 8 +- crates/terminal_view/src/terminal_view.rs | 10 +- crates/theme_selector/src/theme_selector.rs | 8 +- crates/title_bar/src/application_menu.rs | 10 +- crates/title_bar/src/collab.rs | 12 +- crates/title_bar/src/title_bar.rs | 12 +- .../src/toolchain_selector.rs | 8 +- crates/vim/src/change_list.rs | 10 +- crates/vim/src/command.rs | 21 +- crates/vim/src/helix.rs | 8 +- crates/vim/src/indent.rs | 12 +- crates/vim/src/insert.rs | 10 +- crates/vim/src/motion.rs | 55 ++++ crates/vim/src/normal.rs | 27 ++ crates/vim/src/normal/increment.rs | 2 + crates/vim/src/normal/paste.rs | 1 + crates/vim/src/normal/repeat.rs | 14 +- crates/vim/src/normal/scroll.rs | 8 + crates/vim/src/normal/search.rs | 17 +- crates/vim/src/normal/substitute.rs | 10 +- crates/vim/src/object.rs | 23 ++ crates/vim/src/replace.rs | 10 +- crates/vim/src/rewrap.rs | 8 +- crates/vim/src/vim.rs | 52 +++- crates/vim/src/visual.rs | 18 ++ crates/welcome/src/base_keymap_picker.rs | 8 +- crates/welcome/src/welcome.rs | 8 +- crates/workspace/src/pane.rs | 29 ++ crates/workspace/src/theme_preview.rs | 8 +- crates/workspace/src/workspace.rs | 72 ++++- crates/zed/src/main.rs | 2 + crates/zed/src/zed.rs | 14 + crates/zed_actions/src/lib.rs | 129 ++++++++- crates/zeta/src/init.rs | 10 +- crates/zeta/src/rate_completion_modal.rs | 6 + crates/zeta/src/zeta.rs | 8 +- 96 files changed, 1467 insertions(+), 78 deletions(-) diff --git a/crates/activity_indicator/src/activity_indicator.rs b/crates/activity_indicator/src/activity_indicator.rs index b3287e8222..b07c541821 100644 --- a/crates/activity_indicator/src/activity_indicator.rs +++ b/crates/activity_indicator/src/activity_indicator.rs @@ -31,7 +31,13 @@ use workspace::{StatusItemView, Workspace, item::ItemHandle}; const GIT_OPERATION_DELAY: Duration = Duration::from_millis(0); -actions!(activity_indicator, [ShowErrorMessage]); +actions!( + activity_indicator, + [ + /// Displays error messages from language servers in the status bar. + ShowErrorMessage + ] +); pub enum Event { ShowStatus { diff --git a/crates/agent_ui/src/agent_ui.rs b/crates/agent_ui/src/agent_ui.rs index b5ab5a147e..e488cf5a1e 100644 --- a/crates/agent_ui/src/agent_ui.rs +++ b/crates/agent_ui/src/agent_ui.rs @@ -54,42 +54,76 @@ pub use ui::preview::{all_agent_previews, get_agent_preview}; actions!( agent, [ + /// Creates a new text-based conversation thread. NewTextThread, + /// Toggles the context picker interface for adding files, symbols, or other context. ToggleContextPicker, + /// Toggles the navigation menu for switching between threads and views. ToggleNavigationMenu, + /// Toggles the options menu for agent settings and preferences. ToggleOptionsMenu, + /// Deletes the recently opened thread from history. DeleteRecentlyOpenThread, + /// Toggles the profile selector for switching between agent profiles. ToggleProfileSelector, + /// Removes all added context from the current conversation. RemoveAllContext, + /// Expands the message editor to full size. ExpandMessageEditor, + /// Opens the conversation history view. OpenHistory, + /// Adds a context server to the configuration. AddContextServer, + /// Removes the currently selected thread. RemoveSelectedThread, + /// Starts a chat conversation with the agent. Chat, + /// Starts a chat conversation with follow-up enabled. ChatWithFollow, + /// Cycles to the next inline assist suggestion. CycleNextInlineAssist, + /// Cycles to the previous inline assist suggestion. CyclePreviousInlineAssist, + /// Moves focus up in the interface. FocusUp, + /// Moves focus down in the interface. FocusDown, + /// Moves focus left in the interface. FocusLeft, + /// Moves focus right in the interface. FocusRight, + /// Removes the currently focused context item. RemoveFocusedContext, + /// Accepts the suggested context item. AcceptSuggestedContext, + /// Opens the active thread as a markdown file. OpenActiveThreadAsMarkdown, + /// Opens the agent diff view to review changes. OpenAgentDiff, + /// Keeps the current suggestion or change. Keep, + /// Rejects the current suggestion or change. Reject, + /// Rejects all suggestions or changes. RejectAll, + /// Keeps all suggestions or changes. KeepAll, + /// Follows the agent's suggestions. Follow, + /// Resets the trial upsell notification. ResetTrialUpsell, + /// Resets the trial end upsell notification. ResetTrialEndUpsell, + /// Continues the current thread. ContinueThread, + /// Continues the thread with burn mode enabled. ContinueWithBurnMode, + /// Toggles burn mode for faster responses. ToggleBurnMode, ] ); +/// Creates a new conversation thread, optionally based on an existing thread. #[derive(Default, Clone, PartialEq, Deserialize, JsonSchema, Action)] #[action(namespace = agent)] #[serde(deny_unknown_fields)] @@ -98,6 +132,7 @@ pub struct NewThread { from_thread_id: Option, } +/// Opens the profile management interface for configuring agent tools and settings. #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[action(namespace = agent)] #[serde(deny_unknown_fields)] diff --git a/crates/agent_ui/src/language_model_selector.rs b/crates/agent_ui/src/language_model_selector.rs index 55c0974fc1..ff18a95f3f 100644 --- a/crates/agent_ui/src/language_model_selector.rs +++ b/crates/agent_ui/src/language_model_selector.rs @@ -18,6 +18,7 @@ use ui::{ListItem, ListItemSpacing, prelude::*}; actions!( agent, [ + /// Toggles the language model selector dropdown. #[action(deprecated_aliases = ["assistant::ToggleModelSelector", "assistant2::ToggleModelSelector"])] ToggleModelSelector ] diff --git a/crates/agent_ui/src/text_thread_editor.rs b/crates/agent_ui/src/text_thread_editor.rs index d11deb7908..465b3b4e58 100644 --- a/crates/agent_ui/src/text_thread_editor.rs +++ b/crates/agent_ui/src/text_thread_editor.rs @@ -85,16 +85,24 @@ use assistant_context::{ actions!( assistant, [ + /// Sends the current message to the assistant. Assist, + /// Confirms and executes the entered slash command. ConfirmCommand, + /// Copies code from the assistant's response to the clipboard. CopyCode, + /// Cycles between user and assistant message roles. CycleMessageRole, + /// Inserts the selected text into the active editor. InsertIntoEditor, + /// Quotes the current selection in the assistant conversation. QuoteSelection, + /// Splits the conversation at the current cursor position. Split, ] ); +/// Inserts files that were dragged and dropped into the assistant conversation. #[derive(PartialEq, Clone, Action)] #[action(namespace = assistant, no_json, no_register)] pub enum InsertDraggedFiles { diff --git a/crates/auto_update/src/auto_update.rs b/crates/auto_update/src/auto_update.rs index 26eb36118a..70039060ca 100644 --- a/crates/auto_update/src/auto_update.rs +++ b/crates/auto_update/src/auto_update.rs @@ -28,7 +28,17 @@ use workspace::Workspace; const SHOULD_SHOW_UPDATE_NOTIFICATION_KEY: &str = "auto-updater-should-show-updated-notification"; const POLL_INTERVAL: Duration = Duration::from_secs(60 * 60); -actions!(auto_update, [Check, DismissErrorMessage, ViewReleaseNotes,]); +actions!( + auto_update, + [ + /// Checks for available updates. + Check, + /// Dismisses the update error message. + DismissErrorMessage, + /// Opens the release notes for the current version. + ViewReleaseNotes, + ] +); #[derive(Serialize)] struct UpdateRequestBody { diff --git a/crates/auto_update_ui/src/auto_update_ui.rs b/crates/auto_update_ui/src/auto_update_ui.rs index afb135bc97..5d79fb5db8 100644 --- a/crates/auto_update_ui/src/auto_update_ui.rs +++ b/crates/auto_update_ui/src/auto_update_ui.rs @@ -12,7 +12,13 @@ use workspace::Workspace; use workspace::notifications::simple_message_notification::MessageNotification; use workspace::notifications::{NotificationId, show_app_notification}; -actions!(auto_update, [ViewReleaseNotesLocally]); +actions!( + auto_update, + [ + /// Opens release notes in the browser for the current version. + ViewReleaseNotesLocally + ] +); pub fn init(cx: &mut App) { notify_if_app_was_updated(cx); diff --git a/crates/client/src/client.rs b/crates/client/src/client.rs index 86612bd15b..c4211f72c8 100644 --- a/crates/client/src/client.rs +++ b/crates/client/src/client.rs @@ -81,7 +81,17 @@ pub const INITIAL_RECONNECTION_DELAY: Duration = Duration::from_millis(500); pub const MAX_RECONNECTION_DELAY: Duration = Duration::from_secs(10); pub const CONNECTION_TIMEOUT: Duration = Duration::from_secs(20); -actions!(client, [SignIn, SignOut, Reconnect]); +actions!( + client, + [ + /// Signs in to Zed account. + SignIn, + /// Signs out of Zed account. + SignOut, + /// Reconnects to the collaboration server. + Reconnect + ] +); #[derive(Clone, Default, Serialize, Deserialize, JsonSchema)] pub struct ClientSettingsContent { diff --git a/crates/collab_ui/src/channel_view.rs b/crates/collab_ui/src/channel_view.rs index c872f99aa1..b86d72d92f 100644 --- a/crates/collab_ui/src/channel_view.rs +++ b/crates/collab_ui/src/channel_view.rs @@ -30,7 +30,13 @@ use workspace::{ }; use workspace::{item::Dedup, notifications::NotificationId}; -actions!(collab, [CopyLink]); +actions!( + collab, + [ + /// Copies a link to the current position in the channel buffer. + CopyLink + ] +); pub fn init(cx: &mut App) { workspace::FollowableViewRegistry::register::(cx) diff --git a/crates/collab_ui/src/chat_panel.rs b/crates/collab_ui/src/chat_panel.rs index 54c45a9fec..3e2d813f1b 100644 --- a/crates/collab_ui/src/chat_panel.rs +++ b/crates/collab_ui/src/chat_panel.rs @@ -71,7 +71,13 @@ struct SerializedChatPanel { width: Option, } -actions!(chat_panel, [ToggleFocus]); +actions!( + chat_panel, + [ + /// Toggles focus on the chat panel. + ToggleFocus + ] +); impl ChatPanel { pub fn new( diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rs index 6501d3a566..ec23e2c3f5 100644 --- a/crates/collab_ui/src/collab_panel.rs +++ b/crates/collab_ui/src/collab_panel.rs @@ -44,15 +44,25 @@ use workspace::{ actions!( collab_panel, [ + /// Toggles focus on the collaboration panel. ToggleFocus, + /// Removes the selected channel or contact. Remove, + /// Opens the context menu for the selected item. Secondary, + /// Collapses the selected channel in the tree view. CollapseSelectedChannel, + /// Expands the selected channel in the tree view. ExpandSelectedChannel, + /// Starts moving a channel to a new location. StartMoveChannel, + /// Moves the selected item to the current location. MoveSelected, + /// Inserts a space character in the filter input. InsertSpace, + /// Moves the selected channel up in the list. MoveChannelUp, + /// Moves the selected channel down in the list. MoveChannelDown, ] ); diff --git a/crates/collab_ui/src/collab_panel/channel_modal.rs b/crates/collab_ui/src/collab_panel/channel_modal.rs index 9af7baa160..c0d3130ee9 100644 --- a/crates/collab_ui/src/collab_panel/channel_modal.rs +++ b/crates/collab_ui/src/collab_panel/channel_modal.rs @@ -17,9 +17,13 @@ use workspace::{ModalView, notifications::DetachAndPromptErr}; actions!( channel_modal, [ + /// Selects the next control in the channel modal. SelectNextControl, + /// Toggles between invite members and manage members mode. ToggleMode, + /// Toggles admin status for the selected member. ToggleMemberAdmin, + /// Removes the selected member from the channel. RemoveMember ] ); diff --git a/crates/collab_ui/src/notification_panel.rs b/crates/collab_ui/src/notification_panel.rs index 5e5e8164f9..fba8f66c2d 100644 --- a/crates/collab_ui/src/notification_panel.rs +++ b/crates/collab_ui/src/notification_panel.rs @@ -74,7 +74,13 @@ pub struct NotificationPresenter { pub can_navigate: bool, } -actions!(notification_panel, [ToggleFocus]); +actions!( + notification_panel, + [ + /// Toggles focus on the notification panel. + ToggleFocus + ] +); pub fn init(cx: &mut App) { cx.observe_new(|workspace: &mut Workspace, _, _| { diff --git a/crates/copilot/src/copilot.rs b/crates/copilot/src/copilot.rs index 51f0984a1f..e4370d2e67 100644 --- a/crates/copilot/src/copilot.rs +++ b/crates/copilot/src/copilot.rs @@ -46,11 +46,17 @@ pub use crate::sign_in::{CopilotCodeVerification, initiate_sign_in, reinstall_an actions!( copilot, [ + /// Requests a code completion suggestion from Copilot. Suggest, + /// Cycles to the next Copilot suggestion. NextSuggestion, + /// Cycles to the previous Copilot suggestion. PreviousSuggestion, + /// Reinstalls the Copilot language server. Reinstall, + /// Signs in to GitHub Copilot. SignIn, + /// Signs out of GitHub Copilot. SignOut ] ); diff --git a/crates/debugger_tools/src/dap_log.rs b/crates/debugger_tools/src/dap_log.rs index 532107f633..f2f193cad4 100644 --- a/crates/debugger_tools/src/dap_log.rs +++ b/crates/debugger_tools/src/dap_log.rs @@ -918,7 +918,13 @@ impl Render for DapLogView { } } -actions!(dev, [OpenDebugAdapterLogs]); +actions!( + dev, + [ + /// Opens the debug adapter protocol logs viewer. + OpenDebugAdapterLogs + ] +); pub fn init(cx: &mut App) { let log_store = cx.new(|cx| LogStore::new(cx)); diff --git a/crates/debugger_ui/src/debugger_ui.rs b/crates/debugger_ui/src/debugger_ui.rs index 71b3ce1a31..2056232e9b 100644 --- a/crates/debugger_ui/src/debugger_ui.rs +++ b/crates/debugger_ui/src/debugger_ui.rs @@ -32,36 +32,67 @@ pub mod tests; actions!( debugger, [ + /// Starts a new debugging session. Start, + /// Continues execution until the next breakpoint. Continue, + /// Detaches the debugger from the running process. Detach, + /// Pauses the currently running program. Pause, + /// Restarts the current debugging session. Restart, + /// Reruns the current debugging session with the same configuration. RerunSession, + /// Steps into the next function call. StepInto, + /// Steps over the current line. StepOver, + /// Steps out of the current function. StepOut, + /// Steps back to the previous statement. StepBack, + /// Stops the debugging session. Stop, + /// Toggles whether to ignore all breakpoints. ToggleIgnoreBreakpoints, + /// Clears all breakpoints in the project. ClearAllBreakpoints, + /// Focuses on the debugger console panel. FocusConsole, + /// Focuses on the variables panel. FocusVariables, + /// Focuses on the breakpoint list panel. FocusBreakpointList, + /// Focuses on the call stack frames panel. FocusFrames, + /// Focuses on the loaded modules panel. FocusModules, + /// Focuses on the loaded sources panel. FocusLoadedSources, + /// Focuses on the terminal panel. FocusTerminal, + /// Shows the stack trace for the current thread. ShowStackTrace, + /// Toggles the thread picker dropdown. ToggleThreadPicker, + /// Toggles the session picker dropdown. ToggleSessionPicker, + /// Reruns the last debugging session. #[action(deprecated_aliases = ["debugger::RerunLastSession"])] Rerun, + /// Toggles expansion of the selected item in the debugger UI. ToggleExpandItem, ] ); -actions!(dev, [CopyDebugAdapterArguments]); +actions!( + dev, + [ + /// Copies debug adapter launch arguments to clipboard. + CopyDebugAdapterArguments + ] +); pub fn init(cx: &mut App) { DebuggerSettings::register(cx); diff --git a/crates/debugger_ui/src/session/running/breakpoint_list.rs b/crates/debugger_ui/src/session/running/breakpoint_list.rs index 5576435a08..2ec20c9877 100644 --- a/crates/debugger_ui/src/session/running/breakpoint_list.rs +++ b/crates/debugger_ui/src/session/running/breakpoint_list.rs @@ -33,7 +33,12 @@ use zed_actions::{ToggleEnableBreakpoint, UnsetBreakpoint}; actions!( debugger, - [PreviousBreakpointProperty, NextBreakpointProperty] + [ + /// Navigates to the previous breakpoint property in the list. + PreviousBreakpointProperty, + /// Navigates to the next breakpoint property in the list. + NextBreakpointProperty + ] ); #[derive(Clone, Copy, PartialEq)] pub(crate) enum SelectedBreakpointKind { diff --git a/crates/debugger_ui/src/session/running/console.rs b/crates/debugger_ui/src/session/running/console.rs index aaac636401..c247f93ca1 100644 --- a/crates/debugger_ui/src/session/running/console.rs +++ b/crates/debugger_ui/src/session/running/console.rs @@ -23,7 +23,13 @@ use std::{cell::RefCell, ops::Range, rc::Rc, usize}; use theme::{Theme, ThemeSettings}; use ui::{ContextMenu, Divider, PopoverMenu, SplitButton, Tooltip, prelude::*}; -actions!(console, [WatchExpression]); +actions!( + console, + [ + /// Adds an expression to the watch list. + WatchExpression + ] +); pub struct Console { console: Entity, diff --git a/crates/debugger_ui/src/session/running/variable_list.rs b/crates/debugger_ui/src/session/running/variable_list.rs index c58ac865f9..bdb095bde3 100644 --- a/crates/debugger_ui/src/session/running/variable_list.rs +++ b/crates/debugger_ui/src/session/running/variable_list.rs @@ -18,12 +18,19 @@ use util::debug_panic; actions!( variable_list, [ + /// Expands the selected variable entry to show its children. ExpandSelectedEntry, + /// Collapses the selected variable entry to hide its children. CollapseSelectedEntry, + /// Copies the variable name to the clipboard. CopyVariableName, + /// Copies the variable value to the clipboard. CopyVariableValue, + /// Edits the value of the selected variable. EditVariable, + /// Adds the selected variable to the watch list. AddWatch, + /// Removes the selected variable from the watch list. RemoveWatch, ] ); diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs index 8b49c53624..1daa9025b6 100644 --- a/crates/diagnostics/src/diagnostics.rs +++ b/crates/diagnostics/src/diagnostics.rs @@ -48,7 +48,14 @@ use workspace::{ actions!( diagnostics, - [Deploy, ToggleWarnings, ToggleDiagnosticsRefresh] + [ + /// Opens the project diagnostics view. + Deploy, + /// Toggles the display of warning-level diagnostics. + ToggleWarnings, + /// Toggles automatic refresh of diagnostics. + ToggleDiagnosticsRefresh + ] ); #[derive(Default)] diff --git a/crates/editor/src/actions.rs b/crates/editor/src/actions.rs index b6e7845908..def2a616a8 100644 --- a/crates/editor/src/actions.rs +++ b/crates/editor/src/actions.rs @@ -4,6 +4,7 @@ use gpui::{Action, actions}; use schemars::JsonSchema; use util::serde::default_true; +/// Selects the next occurrence of the current selection. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -12,6 +13,7 @@ pub struct SelectNext { pub replace_newest: bool, } +/// Selects the previous occurrence of the current selection. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -20,6 +22,7 @@ pub struct SelectPrevious { pub replace_newest: bool, } +/// Moves the cursor to the beginning of the current line. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -30,6 +33,7 @@ pub struct MoveToBeginningOfLine { pub stop_at_indent: bool, } +/// Selects from the cursor to the beginning of the current line. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -40,6 +44,7 @@ pub struct SelectToBeginningOfLine { pub stop_at_indent: bool, } +/// Deletes from the cursor to the beginning of the current line. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -48,6 +53,7 @@ pub struct DeleteToBeginningOfLine { pub(super) stop_at_indent: bool, } +/// Moves the cursor up by one page. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -56,6 +62,7 @@ pub struct MovePageUp { pub(super) center_cursor: bool, } +/// Moves the cursor down by one page. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -64,6 +71,7 @@ pub struct MovePageDown { pub(super) center_cursor: bool, } +/// Moves the cursor to the end of the current line. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -72,6 +80,7 @@ pub struct MoveToEndOfLine { pub stop_at_soft_wraps: bool, } +/// Selects from the cursor to the end of the current line. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -80,6 +89,7 @@ pub struct SelectToEndOfLine { pub(super) stop_at_soft_wraps: bool, } +/// Toggles the display of available code actions at the cursor position. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -101,6 +111,7 @@ pub enum CodeActionSource { QuickActionBar, } +/// Confirms and accepts the currently selected completion suggestion. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -109,6 +120,7 @@ pub struct ConfirmCompletion { pub item_ix: Option, } +/// Composes multiple completion suggestions into a single completion. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -117,6 +129,7 @@ pub struct ComposeCompletion { pub item_ix: Option, } +/// Confirms and applies the currently selected code action. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -125,6 +138,7 @@ pub struct ConfirmCodeAction { pub item_ix: Option, } +/// Toggles comment markers for the selected lines. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -135,6 +149,7 @@ pub struct ToggleComments { pub ignore_indent: bool, } +/// Moves the cursor up by a specified number of lines. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -143,6 +158,7 @@ pub struct MoveUpByLines { pub(super) lines: u32, } +/// Moves the cursor down by a specified number of lines. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -151,6 +167,7 @@ pub struct MoveDownByLines { pub(super) lines: u32, } +/// Extends selection up by a specified number of lines. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -159,6 +176,7 @@ pub struct SelectUpByLines { pub(super) lines: u32, } +/// Extends selection down by a specified number of lines. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -167,6 +185,7 @@ pub struct SelectDownByLines { pub(super) lines: u32, } +/// Expands all excerpts in the editor. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -175,6 +194,7 @@ pub struct ExpandExcerpts { pub(super) lines: u32, } +/// Expands excerpts above the current position. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -183,6 +203,7 @@ pub struct ExpandExcerptsUp { pub(super) lines: u32, } +/// Expands excerpts below the current position. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -191,6 +212,7 @@ pub struct ExpandExcerptsDown { pub(super) lines: u32, } +/// Shows code completion suggestions at the cursor position. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -199,10 +221,12 @@ pub struct ShowCompletions { pub(super) trigger: Option, } +/// Handles text input in the editor. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] pub struct HandleInput(pub String); +/// Deletes from the cursor to the end of the next word. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -211,6 +235,7 @@ pub struct DeleteToNextWordEnd { pub ignore_newlines: bool, } +/// Deletes from the cursor to the start of the previous word. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -219,10 +244,12 @@ pub struct DeleteToPreviousWordStart { pub ignore_newlines: bool, } +/// Folds all code blocks at the specified indentation level. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] pub struct FoldAtLevel(pub u32); +/// Spawns the nearest available task from the current cursor position. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] #[serde(deny_unknown_fields)] @@ -238,11 +265,20 @@ pub enum UuidVersion { V7, } -actions!(debugger, [RunToCursor, EvaluateSelectedText]); +actions!( + debugger, + [ + /// Runs program execution to the current cursor position. + RunToCursor, + /// Evaluates the selected text in the debugger context. + EvaluateSelectedText + ] +); actions!( go_to_line, [ + /// Toggles the go to line dialog. #[action(name = "Toggle")] ToggleGoToLine ] @@ -251,219 +287,430 @@ actions!( actions!( editor, [ + /// Accepts the full edit prediction. AcceptEditPrediction, + /// Accepts a partial Copilot suggestion. AcceptPartialCopilotSuggestion, + /// Accepts a partial edit prediction. AcceptPartialEditPrediction, + /// Adds a cursor above the current selection. AddSelectionAbove, + /// Adds a cursor below the current selection. AddSelectionBelow, + /// Applies all diff hunks in the editor. ApplyAllDiffHunks, + /// Applies the diff hunk at the current position. ApplyDiffHunk, + /// Deletes the character before the cursor. Backspace, + /// Cancels the current operation. Cancel, + /// Cancels the running flycheck operation. CancelFlycheck, + /// Cancels pending language server work. CancelLanguageServerWork, + /// Clears flycheck results. ClearFlycheck, + /// Confirms the rename operation. ConfirmRename, + /// Confirms completion by inserting at cursor. ConfirmCompletionInsert, + /// Confirms completion by replacing existing text. ConfirmCompletionReplace, + /// Navigates to the first item in the context menu. ContextMenuFirst, + /// Navigates to the last item in the context menu. ContextMenuLast, + /// Navigates to the next item in the context menu. ContextMenuNext, + /// Navigates to the previous item in the context menu. ContextMenuPrevious, + /// Converts indentation from tabs to spaces. ConvertIndentationToSpaces, + /// Converts indentation from spaces to tabs. ConvertIndentationToTabs, + /// Converts selected text to kebab-case. ConvertToKebabCase, + /// Converts selected text to lowerCamelCase. ConvertToLowerCamelCase, + /// Converts selected text to lowercase. ConvertToLowerCase, + /// Toggles the case of selected text. ConvertToOppositeCase, + /// Converts selected text to snake_case. ConvertToSnakeCase, + /// Converts selected text to Title Case. ConvertToTitleCase, + /// Converts selected text to UpperCamelCase. ConvertToUpperCamelCase, + /// Converts selected text to UPPERCASE. ConvertToUpperCase, + /// Applies ROT13 cipher to selected text. ConvertToRot13, + /// Applies ROT47 cipher to selected text. ConvertToRot47, + /// Copies selected text to the clipboard. Copy, + /// Copies selected text to the clipboard with leading/trailing whitespace trimmed. CopyAndTrim, + /// Copies the current file location to the clipboard. CopyFileLocation, + /// Copies the highlighted text as JSON. CopyHighlightJson, + /// Copies the current file name to the clipboard. CopyFileName, + /// Copies the file name without extension to the clipboard. CopyFileNameWithoutExtension, + /// Copies a permalink to the current line. CopyPermalinkToLine, + /// Cuts selected text to the clipboard. Cut, + /// Cuts from cursor to end of line. CutToEndOfLine, + /// Deletes the character after the cursor. Delete, + /// Deletes the current line. DeleteLine, + /// Deletes from cursor to end of line. DeleteToEndOfLine, + /// Deletes to the end of the next subword. DeleteToNextSubwordEnd, + /// Deletes to the start of the previous subword. DeleteToPreviousSubwordStart, + /// Displays names of all active cursors. DisplayCursorNames, + /// Duplicates the current line below. DuplicateLineDown, + /// Duplicates the current line above. DuplicateLineUp, + /// Duplicates the current selection. DuplicateSelection, + /// Expands all diff hunks in the editor. #[action(deprecated_aliases = ["editor::ExpandAllHunkDiffs"])] ExpandAllDiffHunks, + /// Expands macros recursively at cursor position. ExpandMacroRecursively, + /// Finds all references to the symbol at cursor. FindAllReferences, + /// Finds the next match in the search. FindNextMatch, + /// Finds the previous match in the search. FindPreviousMatch, + /// Folds the current code block. Fold, + /// Folds all foldable regions in the editor. FoldAll, + /// Folds all function bodies in the editor. FoldFunctionBodies, + /// Folds the current code block and all its children. FoldRecursive, + /// Folds the selected ranges. FoldSelectedRanges, + /// Toggles folding at the current position. ToggleFold, + /// Toggles recursive folding at the current position. ToggleFoldRecursive, + /// Formats the entire document. Format, + /// Formats only the selected text. FormatSelections, + /// Goes to the declaration of the symbol at cursor. GoToDeclaration, + /// Goes to declaration in a split pane. GoToDeclarationSplit, + /// Goes to the definition of the symbol at cursor. GoToDefinition, + /// Goes to definition in a split pane. GoToDefinitionSplit, + /// Goes to the next diagnostic in the file. GoToDiagnostic, + /// Goes to the next diff hunk. GoToHunk, + /// Goes to the previous diff hunk. GoToPreviousHunk, + /// Goes to the implementation of the symbol at cursor. GoToImplementation, + /// Goes to implementation in a split pane. GoToImplementationSplit, + /// Goes to the next change in the file. GoToNextChange, + /// Goes to the parent module of the current file. GoToParentModule, + /// Goes to the previous change in the file. GoToPreviousChange, + /// Goes to the previous diagnostic in the file. GoToPreviousDiagnostic, + /// Goes to the type definition of the symbol at cursor. GoToTypeDefinition, + /// Goes to type definition in a split pane. GoToTypeDefinitionSplit, + /// Scrolls down by half a page. HalfPageDown, + /// Scrolls up by half a page. HalfPageUp, + /// Shows hover information for the symbol at cursor. Hover, + /// Increases indentation of selected lines. Indent, + /// Inserts a UUID v4 at cursor position. InsertUuidV4, + /// Inserts a UUID v7 at cursor position. InsertUuidV7, + /// Joins the current line with the next line. JoinLines, + /// Cuts to kill ring (Emacs-style). KillRingCut, + /// Yanks from kill ring (Emacs-style). KillRingYank, + /// Moves cursor down one line. LineDown, + /// Moves cursor up one line. LineUp, + /// Moves cursor down. MoveDown, + /// Moves cursor left. MoveLeft, + /// Moves the current line down. MoveLineDown, + /// Moves the current line up. MoveLineUp, + /// Moves cursor right. MoveRight, + /// Moves cursor to the beginning of the document. MoveToBeginning, + /// Moves cursor to the enclosing bracket. MoveToEnclosingBracket, + /// Moves cursor to the end of the document. MoveToEnd, + /// Moves cursor to the end of the paragraph. MoveToEndOfParagraph, + /// Moves cursor to the end of the next subword. MoveToNextSubwordEnd, + /// Moves cursor to the end of the next word. MoveToNextWordEnd, + /// Moves cursor to the start of the previous subword. MoveToPreviousSubwordStart, + /// Moves cursor to the start of the previous word. MoveToPreviousWordStart, + /// Moves cursor to the start of the paragraph. MoveToStartOfParagraph, + /// Moves cursor to the start of the current excerpt. MoveToStartOfExcerpt, + /// Moves cursor to the start of the next excerpt. MoveToStartOfNextExcerpt, + /// Moves cursor to the end of the current excerpt. MoveToEndOfExcerpt, + /// Moves cursor to the end of the previous excerpt. MoveToEndOfPreviousExcerpt, + /// Moves cursor up. MoveUp, + /// Inserts a new line and moves cursor to it. Newline, + /// Inserts a new line above the current line. NewlineAbove, + /// Inserts a new line below the current line. NewlineBelow, + /// Navigates to the next edit prediction. NextEditPrediction, + /// Scrolls to the next screen. NextScreen, + /// Opens the context menu at cursor position. OpenContextMenu, + /// Opens excerpts from the current file. OpenExcerpts, + /// Opens excerpts in a split pane. OpenExcerptsSplit, + /// Opens the proposed changes editor. OpenProposedChangesEditor, + /// Opens documentation for the symbol at cursor. OpenDocs, + /// Opens a permalink to the current line. OpenPermalinkToLine, + /// Opens the file whose name is selected in the editor. #[action(deprecated_aliases = ["editor::OpenFile"])] OpenSelectedFilename, + /// Opens all selections in a multibuffer. OpenSelectionsInMultibuffer, + /// Opens the URL at cursor position. OpenUrl, + /// Organizes import statements. OrganizeImports, + /// Decreases indentation of selected lines. Outdent, + /// Automatically adjusts indentation based on context. AutoIndent, + /// Scrolls down by one page. PageDown, + /// Scrolls up by one page. PageUp, + /// Pastes from clipboard. Paste, + /// Navigates to the previous edit prediction. PreviousEditPrediction, + /// Redoes the last undone edit. Redo, + /// Redoes the last selection change. RedoSelection, + /// Renames the symbol at cursor. Rename, + /// Restarts the language server for the current file. RestartLanguageServer, + /// Reveals the current file in the system file manager. RevealInFileManager, + /// Reverses the order of selected lines. ReverseLines, + /// Reloads the file from disk. ReloadFile, + /// Rewraps text to fit within the preferred line length. Rewrap, + /// Runs flycheck diagnostics. RunFlycheck, + /// Scrolls the cursor to the bottom of the viewport. ScrollCursorBottom, + /// Scrolls the cursor to the center of the viewport. ScrollCursorCenter, + /// Cycles cursor position between center, top, and bottom. ScrollCursorCenterTopBottom, + /// Scrolls the cursor to the top of the viewport. ScrollCursorTop, + /// Selects all text in the editor. SelectAll, + /// Selects all matches of the current selection. SelectAllMatches, + /// Selects to the start of the current excerpt. SelectToStartOfExcerpt, + /// Selects to the start of the next excerpt. SelectToStartOfNextExcerpt, + /// Selects to the end of the current excerpt. SelectToEndOfExcerpt, + /// Selects to the end of the previous excerpt. SelectToEndOfPreviousExcerpt, + /// Extends selection down. SelectDown, + /// Selects the enclosing symbol. SelectEnclosingSymbol, + /// Selects the next larger syntax node. SelectLargerSyntaxNode, + /// Extends selection left. SelectLeft, + /// Selects the current line. SelectLine, + /// Extends selection down by one page. SelectPageDown, + /// Extends selection up by one page. SelectPageUp, + /// Extends selection right. SelectRight, + /// Selects the next smaller syntax node. SelectSmallerSyntaxNode, + /// Selects to the beginning of the document. SelectToBeginning, + /// Selects to the end of the document. SelectToEnd, + /// Selects to the end of the paragraph. SelectToEndOfParagraph, + /// Selects to the end of the next subword. SelectToNextSubwordEnd, + /// Selects to the end of the next word. SelectToNextWordEnd, + /// Selects to the start of the previous subword. SelectToPreviousSubwordStart, + /// Selects to the start of the previous word. SelectToPreviousWordStart, + /// Selects to the start of the paragraph. SelectToStartOfParagraph, + /// Extends selection up. SelectUp, + /// Shows the system character palette. ShowCharacterPalette, + /// Shows edit prediction at cursor. ShowEditPrediction, + /// Shows signature help for the current function. ShowSignatureHelp, + /// Shows word completions. ShowWordCompletions, + /// Randomly shuffles selected lines. ShuffleLines, + /// Navigates to the next signature in the signature help popup. SignatureHelpNext, + /// Navigates to the previous signature in the signature help popup. SignatureHelpPrevious, + /// Sorts selected lines case-insensitively. SortLinesCaseInsensitive, + /// Sorts selected lines case-sensitively. SortLinesCaseSensitive, + /// Splits selection into individual lines. SplitSelectionIntoLines, + /// Stops the language server for the current file. StopLanguageServer, + /// Switches between source and header files. SwitchSourceHeader, + /// Inserts a tab character or indents. Tab, + /// Removes a tab character or outdents. Backtab, + /// Toggles a breakpoint at the current line. ToggleBreakpoint, + /// Toggles the case of selected text. ToggleCase, + /// Disables the breakpoint at the current line. DisableBreakpoint, + /// Enables the breakpoint at the current line. EnableBreakpoint, + /// Edits the log message for a breakpoint. EditLogBreakpoint, + /// Toggles automatic signature help. ToggleAutoSignatureHelp, + /// Toggles inline git blame display. ToggleGitBlameInline, + /// Opens the git commit for the blame at cursor. OpenGitBlameCommit, + /// Toggles the diagnostics panel. ToggleDiagnostics, + /// Toggles indent guides display. ToggleIndentGuides, + /// Toggles inlay hints display. ToggleInlayHints, + /// Toggles inline values display. ToggleInlineValues, + /// Toggles inline diagnostics display. ToggleInlineDiagnostics, + /// Toggles edit prediction feature. ToggleEditPrediction, + /// Toggles line numbers display. ToggleLineNumbers, + /// Toggles the minimap display. ToggleMinimap, + /// Swaps the start and end of the current selection. SwapSelectionEnds, + /// Sets a mark at the current position. SetMark, + /// Toggles relative line numbers display. ToggleRelativeLineNumbers, + /// Toggles diff display for selected hunks. #[action(deprecated_aliases = ["editor::ToggleHunkDiff"])] ToggleSelectedDiffHunks, + /// Toggles the selection menu. ToggleSelectionMenu, + /// Toggles soft wrap mode. ToggleSoftWrap, + /// Toggles the tab bar display. ToggleTabBar, + /// Transposes characters around cursor. Transpose, + /// Undoes the last edit. Undo, + /// Undoes the last selection change. UndoSelection, + /// Unfolds all folded regions. UnfoldAll, + /// Unfolds lines at cursor. UnfoldLines, + /// Unfolds recursively at cursor. UnfoldRecursive, + /// Removes duplicate lines (case-insensitive). UniqueLinesCaseInsensitive, + /// Removes duplicate lines (case-sensitive). UniqueLinesCaseSensitive, ] ); diff --git a/crates/extension_host/src/extension_host.rs b/crates/extension_host/src/extension_host.rs index 97d8e23f0d..8d3a218a03 100644 --- a/crates/extension_host/src/extension_host.rs +++ b/crates/extension_host/src/extension_host.rs @@ -178,7 +178,13 @@ pub struct ExtensionIndexLanguageEntry { pub grammar: Option>, } -actions!(zed, [ReloadExtensions]); +actions!( + zed, + [ + /// Reloads all installed extensions. + ReloadExtensions + ] +); pub fn init( extension_host_proxy: Arc, diff --git a/crates/extensions_ui/src/extensions_ui.rs b/crates/extensions_ui/src/extensions_ui.rs index e4c2ba4c09..48cb41a006 100644 --- a/crates/extensions_ui/src/extensions_ui.rs +++ b/crates/extensions_ui/src/extensions_ui.rs @@ -38,7 +38,13 @@ use crate::extension_version_selector::{ ExtensionVersionSelector, ExtensionVersionSelectorDelegate, }; -actions!(zed, [InstallDevExtension]); +actions!( + zed, + [ + /// Installs an extension from a local directory for development. + InstallDevExtension + ] +); pub fn init(cx: &mut App) { cx.observe_new(move |workspace: &mut Workspace, window, cx| { diff --git a/crates/feedback/src/feedback.rs b/crates/feedback/src/feedback.rs index 67ba0dc278..40c2707d34 100644 --- a/crates/feedback/src/feedback.rs +++ b/crates/feedback/src/feedback.rs @@ -11,9 +11,13 @@ pub mod system_specs; actions!( zed, [ + /// Copies system specifications to the clipboard for bug reports. CopySystemSpecsIntoClipboard, + /// Opens email client to send feedback to Zed support. EmailZed, + /// Opens the Zed repository on GitHub. OpenZedRepo, + /// Opens the feature request form. RequestFeature, ] ); diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index 5096be6733..a4d61dd56f 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -47,7 +47,14 @@ use workspace::{ actions!( file_finder, - [SelectPrevious, ToggleFilterMenu, ToggleSplitMenu] + [ + /// Selects the previous item in the file finder. + SelectPrevious, + /// Toggles the file filter menu. + ToggleFilterMenu, + /// Toggles the split direction menu. + ToggleSplitMenu + ] ); impl ModalView for FileFinder { diff --git a/crates/git/src/git.rs b/crates/git/src/git.rs index d64d35b789..92cf58b2ad 100644 --- a/crates/git/src/git.rs +++ b/crates/git/src/git.rs @@ -31,38 +31,64 @@ actions!( git, [ // per-hunk + /// Toggles the staged state of the hunk at cursor. ToggleStaged, + /// Stages the current hunk and moves to the next one. StageAndNext, + /// Unstages the current hunk and moves to the next one. UnstageAndNext, + /// Restores the selected hunks to their original state. #[action(deprecated_aliases = ["editor::RevertSelectedHunks"])] Restore, // per-file + /// Shows git blame information for the current file. #[action(deprecated_aliases = ["editor::ToggleGitBlame"])] Blame, + /// Stages the current file. StageFile, + /// Unstages the current file. UnstageFile, // repo-wide + /// Stages all changes in the repository. StageAll, + /// Unstages all changes in the repository. UnstageAll, + /// Restores all tracked files to their last committed state. RestoreTrackedFiles, + /// Moves all untracked files to trash. TrashUntrackedFiles, + /// Undoes the last commit, keeping changes in the working directory. Uncommit, + /// Pushes commits to the remote repository. Push, + /// Pushes commits to a specific remote branch. PushTo, + /// Force pushes commits to the remote repository. ForcePush, + /// Pulls changes from the remote repository. Pull, + /// Fetches changes from the remote repository. Fetch, + /// Fetches changes from a specific remote. FetchFrom, + /// Creates a new commit with staged changes. Commit, + /// Amends the last commit with staged changes. Amend, + /// Cancels the current git operation. Cancel, + /// Expands the commit message editor. ExpandCommitEditor, + /// Generates a commit message using AI. GenerateCommitMessage, + /// Initializes a new git repository. Init, + /// Opens all modified files in the editor. OpenModifiedFiles, ] ); +/// Restores a file to its last committed state, discarding local changes. #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)] #[action(namespace = git, deprecated_aliases = ["editor::RevertFile"])] #[serde(deny_unknown_fields)] diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 86a67fcc59..e26a47ff8f 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -77,11 +77,17 @@ use zed_llm_client::CompletionIntent; actions!( git_panel, [ + /// Closes the git panel. Close, + /// Toggles focus on the git panel. ToggleFocus, + /// Opens the git panel menu. OpenMenu, + /// Focuses on the commit message editor. FocusEditor, + /// Focuses on the changes list. FocusChanges, + /// Toggles automatic co-author suggestions. ToggleFillCoAuthors, ] ); diff --git a/crates/git_ui/src/git_ui.rs b/crates/git_ui/src/git_ui.rs index 1653902bbd..a9ccaf7160 100644 --- a/crates/git_ui/src/git_ui.rs +++ b/crates/git_ui/src/git_ui.rs @@ -31,7 +31,13 @@ pub mod project_diff; pub(crate) mod remote_output; pub mod repository_selector; -actions!(git, [ResetOnboarding]); +actions!( + git, + [ + /// Resets the git onboarding state to show the tutorial again. + ResetOnboarding + ] +); pub fn init(cx: &mut App) { GitPanelSettings::register(cx); diff --git a/crates/git_ui/src/project_diff.rs b/crates/git_ui/src/project_diff.rs index f858bea94c..d6a4e27286 100644 --- a/crates/git_ui/src/project_diff.rs +++ b/crates/git_ui/src/project_diff.rs @@ -41,7 +41,15 @@ use workspace::{ searchable::SearchableItemHandle, }; -actions!(git, [Diff, Add]); +actions!( + git, + [ + /// Shows the diff between the working directory and the index. + Diff, + /// Adds files to the git staging area. + Add + ] +); pub struct ProjectDiff { project: Entity, diff --git a/crates/gpui/src/action.rs b/crates/gpui/src/action.rs index 7885497034..9e979a31ff 100644 --- a/crates/gpui/src/action.rs +++ b/crates/gpui/src/action.rs @@ -150,6 +150,15 @@ pub trait Action: Any + Send { { None } + + /// The documentation for this action, if any. When using the derive macro for actions + /// this will be automatically generated from the doc comments on the action struct. + fn documentation() -> Option<&'static str> + where + Self: Sized, + { + None + } } impl std::fmt::Debug for dyn Action { @@ -254,6 +263,7 @@ pub struct MacroActionData { pub json_schema: fn(&mut schemars::SchemaGenerator) -> Option, pub deprecated_aliases: &'static [&'static str], pub deprecation_message: Option<&'static str>, + pub documentation: Option<&'static str>, } inventory::collect!(MacroActionBuilder); @@ -276,6 +286,7 @@ impl ActionRegistry { json_schema: A::action_json_schema, deprecated_aliases: A::deprecated_aliases(), deprecation_message: A::deprecation_message(), + documentation: A::documentation(), }); } diff --git a/crates/gpui_macros/src/derive_action.rs b/crates/gpui_macros/src/derive_action.rs index c32baba6cb..9c7f97371d 100644 --- a/crates/gpui_macros/src/derive_action.rs +++ b/crates/gpui_macros/src/derive_action.rs @@ -14,6 +14,7 @@ pub(crate) fn derive_action(input: TokenStream) -> TokenStream { let mut no_register = false; let mut namespace = None; let mut deprecated = None; + let mut doc_str: Option = None; for attr in &input.attrs { if attr.path().is_ident("action") { @@ -74,6 +75,22 @@ pub(crate) fn derive_action(input: TokenStream) -> TokenStream { Ok(()) }) .unwrap_or_else(|e| panic!("in #[action] attribute: {}", e)); + } else if attr.path().is_ident("doc") { + use syn::{Expr::Lit, ExprLit, Lit::Str, Meta, MetaNameValue}; + if let Meta::NameValue(MetaNameValue { + value: + Lit(ExprLit { + lit: Str(ref lit_str), + .. + }), + .. + }) = attr.meta + { + let doc = lit_str.value(); + let doc_str = doc_str.get_or_insert_default(); + doc_str.push_str(doc.trim()); + doc_str.push('\n'); + } } } @@ -122,6 +139,13 @@ pub(crate) fn derive_action(input: TokenStream) -> TokenStream { quote! { None } }; + let documentation_fn_body = if let Some(doc) = doc_str { + let doc = doc.trim(); + quote! { Some(#doc) } + } else { + quote! { None } + }; + let registration = if no_register { quote! {} } else { @@ -171,6 +195,10 @@ pub(crate) fn derive_action(input: TokenStream) -> TokenStream { fn deprecation_message() -> Option<&'static str> { #deprecation_fn_body } + + fn documentation() -> Option<&'static str> { + #documentation_fn_body + } } }) } diff --git a/crates/gpui_macros/src/register_action.rs b/crates/gpui_macros/src/register_action.rs index d1910b82b2..ca36ce3186 100644 --- a/crates/gpui_macros/src/register_action.rs +++ b/crates/gpui_macros/src/register_action.rs @@ -34,6 +34,7 @@ pub(crate) fn generate_register_action(type_name: &Ident) -> TokenStream2 { json_schema: <#type_name as gpui::Action>::action_json_schema, deprecated_aliases: <#type_name as gpui::Action>::deprecated_aliases(), deprecation_message: <#type_name as gpui::Action>::deprecation_message(), + documentation: <#type_name as gpui::Action>::documentation(), } } diff --git a/crates/inline_completion_button/src/inline_completion_button.rs b/crates/inline_completion_button/src/inline_completion_button.rs index cf1e808f60..f8123d676a 100644 --- a/crates/inline_completion_button/src/inline_completion_button.rs +++ b/crates/inline_completion_button/src/inline_completion_button.rs @@ -37,7 +37,13 @@ use zed_actions::OpenBrowser; use zed_llm_client::UsageLimit; use zeta::RateCompletions; -actions!(edit_prediction, [ToggleMenu]); +actions!( + edit_prediction, + [ + /// Toggles the inline completion menu. + ToggleMenu + ] +); const COPILOT_SETTINGS_URL: &str = "https://github.com/settings/copilot"; diff --git a/crates/install_cli/src/install_cli.rs b/crates/install_cli/src/install_cli.rs index 99f4a4e3f7..12c094448b 100644 --- a/crates/install_cli/src/install_cli.rs +++ b/crates/install_cli/src/install_cli.rs @@ -8,7 +8,15 @@ use util::ResultExt; use workspace::notifications::{DetachAndPromptErr, NotificationId}; use workspace::{Toast, Workspace}; -actions!(cli, [Install, RegisterZedScheme]); +actions!( + cli, + [ + /// Installs the Zed CLI tool to the system PATH. + Install, + /// Registers the zed:// URL scheme handler. + RegisterZedScheme + ] +); async fn install_script(cx: &AsyncApp) -> Result { let cli_path = cx.update(|cx| cx.path_for_auxiliary_executable("cli"))??; diff --git a/crates/journal/src/journal.rs b/crates/journal/src/journal.rs index 08bdb8e04f..0335a746cd 100644 --- a/crates/journal/src/journal.rs +++ b/crates/journal/src/journal.rs @@ -13,7 +13,13 @@ use std::{ }; use workspace::{AppState, OpenVisible, Workspace}; -actions!(journal, [NewJournalEntry]); +actions!( + journal, + [ + /// Creates a new journal entry for today. + NewJournalEntry + ] +); /// Settings specific to journaling #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)] diff --git a/crates/language_selector/src/language_selector.rs b/crates/language_selector/src/language_selector.rs index 2a4b6de655..4c03430553 100644 --- a/crates/language_selector/src/language_selector.rs +++ b/crates/language_selector/src/language_selector.rs @@ -19,7 +19,13 @@ use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; use workspace::{ModalView, Workspace}; -actions!(language_selector, [Toggle]); +actions!( + language_selector, + [ + /// Toggles the language selector modal. + Toggle + ] +); pub fn init(cx: &mut App) { cx.observe_new(LanguageSelector::register).detach(); diff --git a/crates/language_tools/src/key_context_view.rs b/crates/language_tools/src/key_context_view.rs index 4c7f80de02..c933872d8c 100644 --- a/crates/language_tools/src/key_context_view.rs +++ b/crates/language_tools/src/key_context_view.rs @@ -13,7 +13,13 @@ use ui::{ }; use workspace::{Item, SplitDirection, Workspace}; -actions!(dev, [OpenKeyContextView]); +actions!( + dev, + [ + /// Opens the key context view for debugging keybindings. + OpenKeyContextView + ] +); pub fn init(cx: &mut App) { cx.observe_new(|workspace: &mut Workspace, _, _| { diff --git a/crates/language_tools/src/lsp_log.rs b/crates/language_tools/src/lsp_log.rs index a3827218c3..9d2badd561 100644 --- a/crates/language_tools/src/lsp_log.rs +++ b/crates/language_tools/src/lsp_log.rs @@ -204,7 +204,13 @@ pub(crate) struct LogMenuItem { pub server_kind: LanguageServerKind, } -actions!(dev, [OpenLanguageServerLogs]); +actions!( + dev, + [ + /// Opens the language server protocol logs viewer. + OpenLanguageServerLogs + ] +); pub(super) struct GlobalLogStore(pub WeakEntity); diff --git a/crates/language_tools/src/lsp_tool.rs b/crates/language_tools/src/lsp_tool.rs index 899aaf0679..24a53ae252 100644 --- a/crates/language_tools/src/lsp_tool.rs +++ b/crates/language_tools/src/lsp_tool.rs @@ -19,7 +19,13 @@ use workspace::{StatusItemView, Workspace}; use crate::lsp_log::GlobalLogStore; -actions!(lsp_tool, [ToggleMenu]); +actions!( + lsp_tool, + [ + /// Toggles the language server tool menu. + ToggleMenu + ] +); pub struct LspTool { state: Entity, diff --git a/crates/language_tools/src/syntax_tree_view.rs b/crates/language_tools/src/syntax_tree_view.rs index 6f74e76e26..eadba2c1d2 100644 --- a/crates/language_tools/src/syntax_tree_view.rs +++ b/crates/language_tools/src/syntax_tree_view.rs @@ -15,7 +15,13 @@ use workspace::{ item::{Item, ItemHandle}, }; -actions!(dev, [OpenSyntaxTreeView]); +actions!( + dev, + [ + /// Opens the syntax tree view for the current file. + OpenSyntaxTreeView + ] +); pub fn init(cx: &mut App) { cx.observe_new(|workspace: &mut Workspace, _, _| { diff --git a/crates/markdown/src/markdown.rs b/crates/markdown/src/markdown.rs index 27859f6e08..dba4bc64b1 100644 --- a/crates/markdown/src/markdown.rs +++ b/crates/markdown/src/markdown.rs @@ -141,7 +141,15 @@ pub type CodeBlockRenderFn = Arc< pub type CodeBlockTransformFn = Arc, CodeBlockMetadata, &mut Window, &App) -> AnyDiv>; -actions!(markdown, [Copy, CopyAsMarkdown]); +actions!( + markdown, + [ + /// Copies the selected text to the clipboard. + Copy, + /// Copies the selected text as markdown to the clipboard. + CopyAsMarkdown + ] +); impl Markdown { pub fn new( diff --git a/crates/markdown_preview/src/markdown_preview.rs b/crates/markdown_preview/src/markdown_preview.rs index afc5b964b2..91c0005097 100644 --- a/crates/markdown_preview/src/markdown_preview.rs +++ b/crates/markdown_preview/src/markdown_preview.rs @@ -9,10 +9,15 @@ pub mod markdown_renderer; actions!( markdown, [ + /// Scrolls up by one page in the markdown preview. MovePageUp, + /// Scrolls down by one page in the markdown preview. MovePageDown, + /// Opens a markdown preview for the current file. OpenPreview, + /// Opens a markdown preview in a split pane. OpenPreviewToTheSide, + /// Opens a following markdown preview that syncs with the editor. OpenFollowingPreview ] ); diff --git a/crates/menu/src/menu.rs b/crates/menu/src/menu.rs index 10eeeff8ca..9a1937d100 100644 --- a/crates/menu/src/menu.rs +++ b/crates/menu/src/menu.rs @@ -12,13 +12,21 @@ pub fn init() {} actions!( menu, [ + /// Cancels the current menu operation. Cancel, + /// Confirms the selected menu item. Confirm, + /// Performs secondary confirmation action. SecondaryConfirm, + /// Selects the previous item in the menu. SelectPrevious, + /// Selects the next item in the menu. SelectNext, + /// Selects the first item in the menu. SelectFirst, + /// Selects the last item in the menu. SelectLast, + /// Restarts the menu from the beginning. Restart, EndSlot, ] diff --git a/crates/outline_panel/src/outline_panel.rs b/crates/outline_panel/src/outline_panel.rs index 0be05d4589..05352e24de 100644 --- a/crates/outline_panel/src/outline_panel.rs +++ b/crates/outline_panel/src/outline_panel.rs @@ -65,17 +65,28 @@ use worktree::{Entry, ProjectEntryId, WorktreeId}; actions!( outline_panel, [ + /// Collapses all entries in the outline tree. CollapseAllEntries, + /// Collapses the currently selected entry. CollapseSelectedEntry, + /// Expands all entries in the outline tree. ExpandAllEntries, + /// Expands the currently selected entry. ExpandSelectedEntry, + /// Folds the selected directory. FoldDirectory, + /// Opens the selected entry in the editor. OpenSelectedEntry, + /// Reveals the selected item in the system file manager. RevealInFileManager, + /// Selects the parent of the current entry. SelectParent, + /// Toggles the pin status of the active editor. ToggleActiveEditorPin, - ToggleFocus, + /// Unfolds the selected directory. UnfoldDirectory, + /// Toggles focus on the outline panel. + ToggleFocus, ] ); diff --git a/crates/panel/src/panel.rs b/crates/panel/src/panel.rs index 58edb1e81d..a09034cc17 100644 --- a/crates/panel/src/panel.rs +++ b/crates/panel/src/panel.rs @@ -5,7 +5,15 @@ use settings::Settings; use theme::ThemeSettings; use ui::{Tab, prelude::*}; -actions!(panel, [NextPanelTab, PreviousPanelTab]); +actions!( + panel, + [ + /// Navigates to the next tab in the panel. + NextPanelTab, + /// Navigates to the previous tab in the panel. + PreviousPanelTab + ] +); pub trait PanelHeader: workspace::Panel { fn header_height(&self, cx: &mut App) -> Pixels { diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index 4a122ac731..692bdd5bd7 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -34,7 +34,13 @@ pub enum Direction { Down, } -actions!(picker, [ConfirmCompletion]); +actions!( + picker, + [ + /// Confirms the selected completion in the picker. + ConfirmCompletion + ] +); /// ConfirmInput is an alternative editor action which - instead of selecting active picker entry - treats pickers editor input literally, /// performing some kind of action on it. diff --git a/crates/project/src/context_server_store.rs b/crates/project/src/context_server_store.rs index 6f93238cc9..d13cb37aa8 100644 --- a/crates/project/src/context_server_store.rs +++ b/crates/project/src/context_server_store.rs @@ -21,7 +21,13 @@ pub fn init(cx: &mut App) { extension::init(cx); } -actions!(context_server, [Restart]); +actions!( + context_server, + [ + /// Restarts the context server. + Restart + ] +); #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum ContextServerStatus { diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 657cccf98a..614f8ccf81 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -181,6 +181,7 @@ struct EntryDetails { canonical_path: Option>, } +/// Permanently deletes the selected file or directory. #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[action(namespace = project_panel)] #[serde(deny_unknown_fields)] @@ -189,6 +190,7 @@ struct Delete { pub skip_prompt: bool, } +/// Moves the selected file or directory to the system trash. #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[action(namespace = project_panel)] #[serde(deny_unknown_fields)] @@ -200,32 +202,59 @@ struct Trash { actions!( project_panel, [ + /// Expands the selected entry in the project tree. ExpandSelectedEntry, + /// Collapses the selected entry in the project tree. CollapseSelectedEntry, + /// Collapses all entries in the project tree. CollapseAllEntries, + /// Creates a new directory. NewDirectory, + /// Creates a new file. NewFile, + /// Copies the selected file or directory. Copy, + /// Duplicates the selected file or directory. Duplicate, + /// Reveals the selected item in the system file manager. RevealInFileManager, + /// Removes the selected folder from the project. RemoveFromProject, + /// Opens the selected file with the system's default application. OpenWithSystem, + /// Cuts the selected file or directory. Cut, + /// Pastes the previously cut or copied item. Paste, + /// Renames the selected file or directory. Rename, + /// Opens the selected file in the editor. Open, + /// Opens the selected file in a permanent tab. OpenPermanent, + /// Toggles focus on the project panel. ToggleFocus, + /// Toggles visibility of git-ignored files. ToggleHideGitIgnore, + /// Starts a new search in the selected directory. NewSearchInDirectory, + /// Unfolds the selected directory. UnfoldDirectory, + /// Folds the selected directory. FoldDirectory, + /// Selects the parent directory. SelectParent, + /// Selects the next entry with git changes. SelectNextGitEntry, + /// Selects the previous entry with git changes. SelectPrevGitEntry, + /// Selects the next entry with diagnostics. SelectNextDiagnostic, + /// Selects the previous entry with diagnostics. SelectPrevDiagnostic, + /// Selects the next directory. SelectNextDirectory, + /// Selects the previous directory. SelectPrevDirectory, ] ); diff --git a/crates/repl/src/notebook/notebook_ui.rs b/crates/repl/src/notebook/notebook_ui.rs index 9091feed63..d14f458fa9 100644 --- a/crates/repl/src/notebook/notebook_ui.rs +++ b/crates/repl/src/notebook/notebook_ui.rs @@ -28,12 +28,19 @@ use nbformat::v4::Metadata as NotebookMetadata; actions!( notebook, [ + /// Opens a Jupyter notebook file. OpenNotebook, + /// Runs all cells in the notebook. RunAll, + /// Clears all cell outputs. ClearOutputs, + /// Moves the current cell up. MoveCellUp, + /// Moves the current cell down. MoveCellDown, + /// Adds a new markdown cell. AddMarkdownBlock, + /// Adds a new code cell. AddCodeBlock, ] ); diff --git a/crates/repl/src/repl_sessions_ui.rs b/crates/repl/src/repl_sessions_ui.rs index df7ce574ab..2f4c1f86fc 100644 --- a/crates/repl/src/repl_sessions_ui.rs +++ b/crates/repl/src/repl_sessions_ui.rs @@ -16,13 +16,21 @@ use crate::repl_store::ReplStore; actions!( repl, [ + /// Runs the current cell and advances to the next one. Run, + /// Runs the current cell without advancing. RunInPlace, + /// Clears all outputs in the REPL. ClearOutputs, + /// Opens the REPL sessions panel. Sessions, + /// Interrupts the currently running kernel. Interrupt, + /// Shuts down the current kernel. Shutdown, + /// Restarts the current kernel. Restart, + /// Refreshes the list of available kernelspecs. RefreshKernelspecs ] ); diff --git a/crates/rules_library/src/rules_library.rs b/crates/rules_library/src/rules_library.rs index 5e249162d3..66f589bfd3 100644 --- a/crates/rules_library/src/rules_library.rs +++ b/crates/rules_library/src/rules_library.rs @@ -37,7 +37,16 @@ pub fn init(cx: &mut App) { actions!( rules_library, - [NewRule, DeleteRule, DuplicateRule, ToggleDefaultRule] + [ + /// Creates a new rule in the rules library. + NewRule, + /// Deletes the selected rule. + DeleteRule, + /// Duplicates the selected rule. + DuplicateRule, + /// Toggles whether the selected rule is a default rule. + ToggleDefaultRule + ] ); const BUILT_IN_TOOLTIP_TEXT: &'static str = concat!( diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index 28d61c1357..35c8fcd230 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -46,6 +46,7 @@ use registrar::{ForDeployed, ForDismissed, SearchActionsRegistrar, WithResults}; const MAX_BUFFER_SEARCH_HISTORY_SIZE: usize = 50; +/// Opens the buffer search interface with the specified configuration. #[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)] #[action(namespace = buffer_search)] #[serde(deny_unknown_fields)] @@ -58,7 +59,17 @@ pub struct Deploy { pub selection_search_enabled: bool, } -actions!(buffer_search, [DeployReplace, Dismiss, FocusEditor]); +actions!( + buffer_search, + [ + /// Deploys the search and replace interface. + DeployReplace, + /// Dismisses the search bar. + Dismiss, + /// Focuses back on the editor. + FocusEditor + ] +); impl Deploy { pub fn find() -> Self { diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index dd440e0639..57ca5e56b9 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -47,7 +47,16 @@ use workspace::{ actions!( project_search, - [SearchInNew, ToggleFocus, NextField, ToggleFilters] + [ + /// Searches in a new project search tab. + SearchInNew, + /// Toggles focus between the search bar and the search results. + ToggleFocus, + /// Moves to the next input field. + NextField, + /// Toggles the search filters panel. + ToggleFilters + ] ); #[derive(Default)] diff --git a/crates/search/src/search.rs b/crates/search/src/search.rs index 0af3949071..5f57bfb4b1 100644 --- a/crates/search/src/search.rs +++ b/crates/search/src/search.rs @@ -23,19 +23,35 @@ pub fn init(cx: &mut App) { actions!( search, [ + /// Focuses on the search input field. FocusSearch, + /// Toggles whole word matching. ToggleWholeWord, + /// Toggles case-sensitive search. ToggleCaseSensitive, + /// Toggles searching in ignored files. ToggleIncludeIgnored, + /// Toggles regular expression mode. ToggleRegex, + /// Toggles the replace interface. ToggleReplace, + /// Toggles searching within selection only. ToggleSelection, + /// Selects the next search match. SelectNextMatch, + /// Selects the previous search match. SelectPreviousMatch, + /// Selects all search matches. SelectAllMatches, + /// Cycles through search modes. + CycleMode, + /// Navigates to the next query in search history. NextHistoryQuery, + /// Navigates to the previous query in search history. PreviousHistoryQuery, + /// Replaces all matches. ReplaceAll, + /// Replaces the next match. ReplaceNext, ] ); diff --git a/crates/settings_ui/src/keybindings.rs b/crates/settings_ui/src/keybindings.rs index e725d2907f..85bb843145 100644 --- a/crates/settings_ui/src/keybindings.rs +++ b/crates/settings_ui/src/keybindings.rs @@ -28,10 +28,26 @@ use crate::{ ui_components::table::{Table, TableInteractionState}, }; -actions!(zed, [OpenKeymapEditor]); +actions!( + zed, + [ + /// Opens the keymap editor. + OpenKeymapEditor + ] +); const KEYMAP_EDITOR_NAMESPACE: &'static str = "keymap_editor"; -actions!(keymap_editor, [EditBinding, CopyAction, CopyContext]); +actions!( + keymap_editor, + [ + /// Edits the selected key binding. + EditBinding, + /// Copies the action name to clipboard. + CopyAction, + /// Copies the context predicate to clipboard. + CopyContext + ] +); pub fn init(cx: &mut App) { let keymap_event_channel = KeymapEventChannel::new(); diff --git a/crates/settings_ui/src/settings_ui.rs b/crates/settings_ui/src/settings_ui.rs index 28ffb1ab4a..2f0abb4789 100644 --- a/crates/settings_ui/src/settings_ui.rs +++ b/crates/settings_ui/src/settings_ui.rs @@ -29,6 +29,7 @@ impl FeatureFlag for SettingsUiFeatureFlag { const NAME: &'static str = "settings-ui"; } +/// Imports settings from Visual Studio Code. #[derive(Copy, Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)] #[action(namespace = zed)] #[serde(deny_unknown_fields)] @@ -37,6 +38,7 @@ pub struct ImportVsCodeSettings { pub skip_prompt: bool, } +/// Imports settings from Cursor editor. #[derive(Copy, Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)] #[action(namespace = zed)] #[serde(deny_unknown_fields)] @@ -44,7 +46,13 @@ pub struct ImportCursorSettings { #[serde(default)] pub skip_prompt: bool, } -actions!(zed, [OpenSettingsEditor]); +actions!( + zed, + [ + /// Opens the settings editor. + OpenSettingsEditor + ] +); pub fn init(cx: &mut App) { cx.on_action(|_: &OpenSettingsEditor, cx| { diff --git a/crates/snippets_ui/src/snippets_ui.rs b/crates/snippets_ui/src/snippets_ui.rs index ecd1143c36..1cc16c5576 100644 --- a/crates/snippets_ui/src/snippets_ui.rs +++ b/crates/snippets_ui/src/snippets_ui.rs @@ -54,7 +54,15 @@ impl From for ScopeName { } } -actions!(snippets, [ConfigureSnippets, OpenFolder]); +actions!( + snippets, + [ + /// Opens the snippets configuration file. + ConfigureSnippets, + /// Opens the snippets folder in the file manager. + OpenFolder + ] +); pub fn init(cx: &mut App) { cx.observe_new(register).detach(); diff --git a/crates/supermaven/src/supermaven.rs b/crates/supermaven/src/supermaven.rs index 410cc94c88..ab500fb79d 100644 --- a/crates/supermaven/src/supermaven.rs +++ b/crates/supermaven/src/supermaven.rs @@ -25,7 +25,13 @@ use std::{path::PathBuf, process::Stdio, sync::Arc}; use ui::prelude::*; use util::ResultExt; -actions!(supermaven, [SignOut]); +actions!( + supermaven, + [ + /// Signs out of Supermaven. + SignOut + ] +); pub fn init(client: Arc, cx: &mut App) { let supermaven = cx.new(|_| Supermaven::Starting); diff --git a/crates/svg_preview/src/svg_preview.rs b/crates/svg_preview/src/svg_preview.rs index cbee76be83..ca1891394d 100644 --- a/crates/svg_preview/src/svg_preview.rs +++ b/crates/svg_preview/src/svg_preview.rs @@ -5,7 +5,14 @@ pub mod svg_preview_view; actions!( svg, - [OpenPreview, OpenPreviewToTheSide, OpenFollowingPreview] + [ + /// Opens an SVG preview for the current file. + OpenPreview, + /// Opens an SVG preview in a split pane. + OpenPreviewToTheSide, + /// Opens a following SVG preview that syncs with the editor. + OpenFollowingPreview + ] ); pub fn init(cx: &mut App) { diff --git a/crates/tab_switcher/src/tab_switcher.rs b/crates/tab_switcher/src/tab_switcher.rs index f2fa7b8b69..12af124ec7 100644 --- a/crates/tab_switcher/src/tab_switcher.rs +++ b/crates/tab_switcher/src/tab_switcher.rs @@ -25,6 +25,7 @@ use workspace::{ const PANEL_WIDTH_REMS: f32 = 28.; +/// Toggles the tab switcher interface. #[derive(PartialEq, Clone, Deserialize, JsonSchema, Default, Action)] #[action(namespace = tab_switcher)] #[serde(deny_unknown_fields)] @@ -32,7 +33,15 @@ pub struct Toggle { #[serde(default)] pub select_last: bool, } -actions!(tab_switcher, [CloseSelectedItem, ToggleAll]); +actions!( + tab_switcher, + [ + /// Closes the selected item in the tab switcher. + CloseSelectedItem, + /// Toggles between showing all tabs or just the current pane's tabs. + ToggleAll + ] +); pub struct TabSwitcher { picker: Entity>, diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index e187d2811f..b1f86bf95e 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -73,18 +73,36 @@ use crate::mappings::{colors::to_alac_rgb, keys::to_esc_str}; actions!( terminal, [ + /// Clears the terminal screen. Clear, + /// Copies selected text to the clipboard. Copy, + /// Pastes from the clipboard. Paste, + /// Shows the character palette for special characters. ShowCharacterPalette, + /// Searches for text in the terminal. SearchTest, + /// Scrolls up by one line. ScrollLineUp, + /// Scrolls down by one line. ScrollLineDown, + /// Scrolls up by one page. ScrollPageUp, + /// Scrolls down by one page. ScrollPageDown, + /// Scrolls up by half a page. + ScrollHalfPageUp, + /// Scrolls down by half a page. + ScrollHalfPageDown, + /// Scrolls to the top of the terminal buffer. ScrollToTop, + /// Scrolls to the bottom of the terminal buffer. ScrollToBottom, + /// Toggles vi mode in the terminal. ToggleViMode, + /// Selects all text in the terminal. + SelectAll, ] ); diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs index dc9313a38f..8c55fed2a6 100644 --- a/crates/terminal_view/src/terminal_panel.rs +++ b/crates/terminal_view/src/terminal_panel.rs @@ -46,7 +46,13 @@ use zed_actions::assistant::InlineAssist; const TERMINAL_PANEL_KEY: &str = "TerminalPanel"; -actions!(terminal_panel, [ToggleFocus]); +actions!( + terminal_panel, + [ + /// Toggles focus on the terminal panel. + ToggleFocus + ] +); pub fn init(cx: &mut App) { cx.observe_new( diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rs index 23202ef691..4c1b60154f 100644 --- a/crates/terminal_view/src/terminal_view.rs +++ b/crates/terminal_view/src/terminal_view.rs @@ -70,15 +70,23 @@ const GIT_DIFF_PATH_PREFIXES: &[&str] = &["a", "b"]; #[derive(Clone, Debug, PartialEq)] pub struct ScrollTerminal(pub i32); +/// Sends the specified text directly to the terminal. #[derive(Clone, Debug, Default, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = terminal)] pub struct SendText(String); +/// Sends a keystroke sequence to the terminal. #[derive(Clone, Debug, Default, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = terminal)] pub struct SendKeystroke(String); -actions!(terminal, [RerunTask]); +actions!( + terminal, + [ + /// Reruns the last executed task in the terminal. + RerunTask + ] +); pub fn init(cx: &mut App) { assistant_slash_command::init(cx); diff --git a/crates/theme_selector/src/theme_selector.rs b/crates/theme_selector/src/theme_selector.rs index e7a3f32909..09d9877df8 100644 --- a/crates/theme_selector/src/theme_selector.rs +++ b/crates/theme_selector/src/theme_selector.rs @@ -17,7 +17,13 @@ use zed_actions::{ExtensionCategoryFilter, Extensions}; use crate::icon_theme_selector::{IconThemeSelector, IconThemeSelectorDelegate}; -actions!(theme_selector, [Reload]); +actions!( + theme_selector, + [ + /// Reloads all themes from disk. + Reload + ] +); pub fn init(cx: &mut App) { cx.on_action(|action: &zed_actions::theme_selector::Toggle, cx| { diff --git a/crates/title_bar/src/application_menu.rs b/crates/title_bar/src/application_menu.rs index 58efa4ee3e..a7d99cf757 100644 --- a/crates/title_bar/src/application_menu.rs +++ b/crates/title_bar/src/application_menu.rs @@ -12,7 +12,15 @@ use smallvec::SmallVec; use ui::{ContextMenu, PopoverMenu, PopoverMenuHandle, Tooltip, prelude::*}; #[cfg(not(target_os = "macos"))] -actions!(app_menu, [ActivateMenuRight, ActivateMenuLeft]); +actions!( + app_menu, + [ + /// Navigates to the menu item on the right. + ActivateMenuRight, + /// Navigates to the menu item on the left. + ActivateMenuLeft + ] +); #[cfg(not(target_os = "macos"))] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Default, Action)] diff --git a/crates/title_bar/src/collab.rs b/crates/title_bar/src/collab.rs index dbef8e02bf..b2a37a4f1c 100644 --- a/crates/title_bar/src/collab.rs +++ b/crates/title_bar/src/collab.rs @@ -11,7 +11,17 @@ use workspace::notifications::DetachAndPromptErr; use crate::TitleBar; -actions!(collab, [ToggleScreenSharing, ToggleMute, ToggleDeafen]); +actions!( + collab, + [ + /// Toggles screen sharing on or off. + ToggleScreenSharing, + /// Toggles microphone mute. + ToggleMute, + /// Toggles deafen mode (mute both microphone and speakers). + ToggleDeafen + ] +); fn toggle_screen_sharing(_: &ToggleScreenSharing, window: &mut Window, cx: &mut App) { let call = ActiveCall::global(cx).read(cx); diff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rs index 53d1397226..f2006f639d 100644 --- a/crates/title_bar/src/title_bar.rs +++ b/crates/title_bar/src/title_bar.rs @@ -47,7 +47,17 @@ const MAX_PROJECT_NAME_LENGTH: usize = 40; const MAX_BRANCH_NAME_LENGTH: usize = 40; const MAX_SHORT_SHA_LENGTH: usize = 8; -actions!(collab, [ToggleUserMenu, ToggleProjectMenu, SwitchBranch]); +actions!( + collab, + [ + /// Toggles the user menu dropdown. + ToggleUserMenu, + /// Toggles the project menu dropdown. + ToggleProjectMenu, + /// Switches to a different git branch. + SwitchBranch + ] +); pub fn init(cx: &mut App) { TitleBarSettings::register(cx); diff --git a/crates/toolchain_selector/src/toolchain_selector.rs b/crates/toolchain_selector/src/toolchain_selector.rs index 0bb4de4f43..21d95a66de 100644 --- a/crates/toolchain_selector/src/toolchain_selector.rs +++ b/crates/toolchain_selector/src/toolchain_selector.rs @@ -15,7 +15,13 @@ use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; use workspace::{ModalView, Workspace}; -actions!(toolchain, [Select]); +actions!( + toolchain, + [ + /// Selects a toolchain for the current project. + Select + ] +); pub fn init(cx: &mut App) { cx.observe_new(ToolchainSelector::register).detach(); diff --git a/crates/vim/src/change_list.rs b/crates/vim/src/change_list.rs index 25da3e09b8..a59083f7ab 100644 --- a/crates/vim/src/change_list.rs +++ b/crates/vim/src/change_list.rs @@ -3,7 +3,15 @@ use gpui::{Context, Window, actions}; use crate::{Vim, state::Mode}; -actions!(vim, [ChangeListOlder, ChangeListNewer]); +actions!( + vim, + [ + /// Navigates to an older position in the change list. + ChangeListOlder, + /// Navigates to a newer position in the change list. + ChangeListNewer + ] +); pub(crate) fn register(editor: &mut Editor, cx: &mut Context) { Vim::action(editor, cx, |vim, _: &ChangeListOlder, window, cx| { diff --git a/crates/vim/src/command.rs b/crates/vim/src/command.rs index 83df86d0e8..729e1a7b3c 100644 --- a/crates/vim/src/command.rs +++ b/crates/vim/src/command.rs @@ -44,18 +44,21 @@ use crate::{ visual::VisualDeleteLine, }; +/// Goes to the specified line number in the editor. #[derive(Clone, Debug, PartialEq, Action)] #[action(namespace = vim, no_json, no_register)] pub struct GoToLine { range: CommandRange, } +/// Yanks (copies) text based on the specified range. #[derive(Clone, Debug, PartialEq, Action)] #[action(namespace = vim, no_json, no_register)] pub struct YankCommand { range: CommandRange, } +/// Executes a command with the specified range. #[derive(Clone, Debug, PartialEq, Action)] #[action(namespace = vim, no_json, no_register)] pub struct WithRange { @@ -64,6 +67,7 @@ pub struct WithRange { action: WrappedAction, } +/// Executes a command with the specified count. #[derive(Clone, Debug, PartialEq, Action)] #[action(namespace = vim, no_json, no_register)] pub struct WithCount { @@ -155,12 +159,14 @@ impl VimOption { } } +/// Sets vim options and configuration values. #[derive(Clone, PartialEq, Action)] #[action(namespace = vim, no_json, no_register)] pub struct VimSet { options: Vec, } +/// Saves the current file with optional save intent. #[derive(Clone, PartialEq, Action)] #[action(namespace = vim, no_json, no_register)] struct VimSave { @@ -168,6 +174,7 @@ struct VimSave { pub filename: String, } +/// Deletes the specified marks from the editor. #[derive(Clone, PartialEq, Action)] #[action(namespace = vim, no_json, no_register)] enum DeleteMarks { @@ -177,8 +184,18 @@ enum DeleteMarks { actions!( vim, - [VisualCommand, CountCommand, ShellCommand, ArgumentRequired] + [ + /// Executes a command in visual mode. + VisualCommand, + /// Executes a command with a count prefix. + CountCommand, + /// Executes a shell command. + ShellCommand, + /// Indicates that an argument is required for the command. + ArgumentRequired + ] ); +/// Opens the specified file for editing. #[derive(Clone, PartialEq, Action)] #[action(namespace = vim, no_json, no_register)] struct VimEdit { @@ -1282,6 +1299,7 @@ fn generate_positions(string: &str, query: &str) -> Vec { positions } +/// Applies a command to all lines matching a pattern. #[derive(Debug, PartialEq, Clone, Action)] #[action(namespace = vim, no_json, no_register)] pub(crate) struct OnMatchingLines { @@ -1480,6 +1498,7 @@ impl OnMatchingLines { } } +/// Executes a shell command and returns the output. #[derive(Clone, Debug, PartialEq, Action)] #[action(namespace = vim, no_json, no_register)] pub struct ShellExec { diff --git a/crates/vim/src/helix.rs b/crates/vim/src/helix.rs index 42890d7a06..e271c06a5e 100644 --- a/crates/vim/src/helix.rs +++ b/crates/vim/src/helix.rs @@ -6,7 +6,13 @@ use text::SelectionGoal; use crate::{Vim, motion::Motion, state::Mode}; -actions!(vim, [HelixNormalAfter]); +actions!( + vim, + [ + /// Switches to normal mode after the cursor (Helix-style). + HelixNormalAfter + ] +); pub fn register(editor: &mut Editor, cx: &mut Context) { Vim::action(editor, cx, Vim::helix_normal_after); diff --git a/crates/vim/src/indent.rs b/crates/vim/src/indent.rs index b10fff8b5d..75b1857a5b 100644 --- a/crates/vim/src/indent.rs +++ b/crates/vim/src/indent.rs @@ -13,7 +13,17 @@ pub(crate) enum IndentDirection { Auto, } -actions!(vim, [Indent, Outdent, AutoIndent]); +actions!( + vim, + [ + /// Increases indentation of selected lines. + Indent, + /// Decreases indentation of selected lines. + Outdent, + /// Automatically adjusts indentation based on syntax. + AutoIndent + ] +); pub(crate) fn register(editor: &mut Editor, cx: &mut Context) { Vim::action(editor, cx, |vim, _: &Indent, window, cx| { diff --git a/crates/vim/src/insert.rs b/crates/vim/src/insert.rs index 7b38bed2be..89c60adee7 100644 --- a/crates/vim/src/insert.rs +++ b/crates/vim/src/insert.rs @@ -5,7 +5,15 @@ use language::SelectionGoal; use settings::Settings; use vim_mode_setting::HelixModeSetting; -actions!(vim, [NormalBefore, TemporaryNormal]); +actions!( + vim, + [ + /// Switches to normal mode with cursor positioned before the current character. + NormalBefore, + /// Temporarily switches to normal mode for one command. + TemporaryNormal + ] +); pub fn register(editor: &mut Editor, cx: &mut Context) { Vim::action(editor, cx, Vim::normal_before); diff --git a/crates/vim/src/motion.rs b/crates/vim/src/motion.rs index 2a6e5196bc..a50b238cc5 100644 --- a/crates/vim/src/motion.rs +++ b/crates/vim/src/motion.rs @@ -176,6 +176,7 @@ enum IndentType { Same, } +/// Moves to the start of the next word. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -184,6 +185,7 @@ struct NextWordStart { ignore_punctuation: bool, } +/// Moves to the end of the next word. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -192,6 +194,7 @@ struct NextWordEnd { ignore_punctuation: bool, } +/// Moves to the start of the previous word. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -200,6 +203,7 @@ struct PreviousWordStart { ignore_punctuation: bool, } +/// Moves to the end of the previous word. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -208,6 +212,7 @@ struct PreviousWordEnd { ignore_punctuation: bool, } +/// Moves to the start of the next subword. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -216,6 +221,7 @@ pub(crate) struct NextSubwordStart { pub(crate) ignore_punctuation: bool, } +/// Moves to the end of the next subword. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -224,6 +230,7 @@ pub(crate) struct NextSubwordEnd { pub(crate) ignore_punctuation: bool, } +/// Moves to the start of the previous subword. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -232,6 +239,7 @@ pub(crate) struct PreviousSubwordStart { pub(crate) ignore_punctuation: bool, } +/// Moves to the end of the previous subword. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -240,6 +248,7 @@ pub(crate) struct PreviousSubwordEnd { pub(crate) ignore_punctuation: bool, } +/// Moves cursor up by the specified number of lines. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -248,6 +257,7 @@ pub(crate) struct Up { pub(crate) display_lines: bool, } +/// Moves cursor down by the specified number of lines. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -256,6 +266,7 @@ pub(crate) struct Down { pub(crate) display_lines: bool, } +/// Moves to the first non-whitespace character on the current line. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -264,6 +275,7 @@ struct FirstNonWhitespace { display_lines: bool, } +/// Moves to the end of the current line. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -272,6 +284,7 @@ struct EndOfLine { display_lines: bool, } +/// Moves to the start of the current line. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -280,6 +293,7 @@ pub struct StartOfLine { pub(crate) display_lines: bool, } +/// Moves to the middle of the current line. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -288,6 +302,7 @@ struct MiddleOfLine { display_lines: bool, } +/// Finds the next unmatched bracket or delimiter. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -296,6 +311,7 @@ struct UnmatchedForward { char: char, } +/// Finds the previous unmatched bracket or delimiter. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -307,46 +323,85 @@ struct UnmatchedBackward { actions!( vim, [ + /// Moves cursor left one character. Left, + /// Moves cursor left one character, wrapping to previous line. #[action(deprecated_aliases = ["vim::Backspace"])] WrappingLeft, + /// Moves cursor right one character. Right, + /// Moves cursor right one character, wrapping to next line. #[action(deprecated_aliases = ["vim::Space"])] WrappingRight, + /// Selects the current line. CurrentLine, + /// Moves to the start of the next sentence. SentenceForward, + /// Moves to the start of the previous sentence. SentenceBackward, + /// Moves to the start of the paragraph. StartOfParagraph, + /// Moves to the end of the paragraph. EndOfParagraph, + /// Moves to the start of the document. StartOfDocument, + /// Moves to the end of the document. EndOfDocument, + /// Moves to the matching bracket or delimiter. Matching, + /// Goes to a percentage position in the file. GoToPercentage, + /// Moves to the start of the next line. NextLineStart, + /// Moves to the start of the previous line. PreviousLineStart, + /// Moves to the start of a line downward. StartOfLineDownward, + /// Moves to the end of a line downward. EndOfLineDownward, + /// Goes to a specific column number. GoToColumn, + /// Repeats the last character find. RepeatFind, + /// Repeats the last character find in reverse. RepeatFindReversed, + /// Moves to the top of the window. WindowTop, + /// Moves to the middle of the window. WindowMiddle, + /// Moves to the bottom of the window. WindowBottom, + /// Moves to the start of the next section. NextSectionStart, + /// Moves to the end of the next section. NextSectionEnd, + /// Moves to the start of the previous section. PreviousSectionStart, + /// Moves to the end of the previous section. PreviousSectionEnd, + /// Moves to the start of the next method. NextMethodStart, + /// Moves to the end of the next method. NextMethodEnd, + /// Moves to the start of the previous method. PreviousMethodStart, + /// Moves to the end of the previous method. PreviousMethodEnd, + /// Moves to the next comment. NextComment, + /// Moves to the previous comment. PreviousComment, + /// Moves to the previous line with lesser indentation. PreviousLesserIndent, + /// Moves to the previous line with greater indentation. PreviousGreaterIndent, + /// Moves to the previous line with the same indentation. PreviousSameIndent, + /// Moves to the next line with lesser indentation. NextLesserIndent, + /// Moves to the next line with greater indentation. NextGreaterIndent, + /// Moves to the next line with the same indentation. NextSameIndent, ] ); diff --git a/crates/vim/src/normal.rs b/crates/vim/src/normal.rs index f25467aec4..f772c446fe 100644 --- a/crates/vim/src/normal.rs +++ b/crates/vim/src/normal.rs @@ -36,32 +36,59 @@ use multi_buffer::MultiBufferRow; actions!( vim, [ + /// Inserts text after the cursor. InsertAfter, + /// Inserts text before the cursor. InsertBefore, + /// Inserts at the first non-whitespace character. InsertFirstNonWhitespace, + /// Inserts at the end of the line. InsertEndOfLine, + /// Inserts a new line above the current line. InsertLineAbove, + /// Inserts a new line below the current line. InsertLineBelow, + /// Inserts an empty line above without entering insert mode. InsertEmptyLineAbove, + /// Inserts an empty line below without entering insert mode. InsertEmptyLineBelow, + /// Inserts at the previous insert position. InsertAtPrevious, + /// Joins the current line with the next line. JoinLines, + /// Joins lines without adding whitespace. JoinLinesNoWhitespace, + /// Deletes character to the left. DeleteLeft, + /// Deletes character to the right. DeleteRight, + /// Deletes using Helix-style behavior. HelixDelete, + /// Changes from cursor to end of line. ChangeToEndOfLine, + /// Deletes from cursor to end of line. DeleteToEndOfLine, + /// Yanks (copies) the selected text. Yank, + /// Yanks the entire line. YankLine, + /// Toggles the case of selected text. ChangeCase, + /// Converts selected text to uppercase. ConvertToUpperCase, + /// Converts selected text to lowercase. ConvertToLowerCase, + /// Applies ROT13 cipher to selected text. ConvertToRot13, + /// Applies ROT47 cipher to selected text. ConvertToRot47, + /// Toggles comments for selected lines. ToggleComments, + /// Shows the current location in the file. ShowLocation, + /// Undoes the last change. Undo, + /// Redoes the last undone change. Redo, ] ); diff --git a/crates/vim/src/normal/increment.rs b/crates/vim/src/normal/increment.rs index 09e6e85a5c..51f6e4a0f9 100644 --- a/crates/vim/src/normal/increment.rs +++ b/crates/vim/src/normal/increment.rs @@ -9,6 +9,7 @@ use crate::{Vim, state::Mode}; const BOOLEAN_PAIRS: &[(&str, &str)] = &[("true", "false"), ("yes", "no"), ("on", "off")]; +/// Increments the number under the cursor or toggles boolean values. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -17,6 +18,7 @@ struct Increment { step: bool, } +/// Decrements the number under the cursor or toggles boolean values. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] diff --git a/crates/vim/src/normal/paste.rs b/crates/vim/src/normal/paste.rs index 86a5392b87..07712fbedd 100644 --- a/crates/vim/src/normal/paste.rs +++ b/crates/vim/src/normal/paste.rs @@ -14,6 +14,7 @@ use crate::{ state::{Mode, Register}, }; +/// Pastes text from the specified register at the cursor position. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] diff --git a/crates/vim/src/normal/repeat.rs b/crates/vim/src/normal/repeat.rs index 8799a8b635..5cc3762990 100644 --- a/crates/vim/src/normal/repeat.rs +++ b/crates/vim/src/normal/repeat.rs @@ -11,7 +11,19 @@ use editor::Editor; use gpui::{Action, App, Context, Window, actions}; use workspace::Workspace; -actions!(vim, [Repeat, EndRepeat, ToggleRecord, ReplayLastRecording]); +actions!( + vim, + [ + /// Repeats the last change. + Repeat, + /// Ends the repeat recording. + EndRepeat, + /// Toggles macro recording. + ToggleRecord, + /// Replays the last recorded macro. + ReplayLastRecording + ] +); fn should_replay(action: &dyn Action) -> bool { // skip so that we don't leave the character palette open diff --git a/crates/vim/src/normal/scroll.rs b/crates/vim/src/normal/scroll.rs index f227f982cb..150334376b 100644 --- a/crates/vim/src/normal/scroll.rs +++ b/crates/vim/src/normal/scroll.rs @@ -11,13 +11,21 @@ use settings::Settings; actions!( vim, [ + /// Scrolls up by one line. LineUp, + /// Scrolls down by one line. LineDown, + /// Scrolls right by one column. ColumnRight, + /// Scrolls left by one column. ColumnLeft, + /// Scrolls up by half a page. ScrollUp, + /// Scrolls down by half a page. ScrollDown, + /// Scrolls up by one page. PageUp, + /// Scrolls down by one page. PageDown ] ); diff --git a/crates/vim/src/normal/search.rs b/crates/vim/src/normal/search.rs index 6457798833..182e60e56c 100644 --- a/crates/vim/src/normal/search.rs +++ b/crates/vim/src/normal/search.rs @@ -16,6 +16,7 @@ use crate::{ state::{Mode, SearchState}, }; +/// Moves to the next search match. #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -28,6 +29,7 @@ pub(crate) struct MoveToNext { regex: bool, } +/// Moves to the previous search match. #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -40,6 +42,7 @@ pub(crate) struct MoveToPrevious { regex: bool, } +/// Initiates a search operation with the specified parameters. #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -50,6 +53,7 @@ pub(crate) struct Search { regex: bool, } +/// Executes a find command to search for patterns in the buffer. #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -58,6 +62,7 @@ pub struct FindCommand { pub backwards: bool, } +/// Executes a search and replace command within the specified range. #[derive(Clone, Debug, PartialEq, Action)] #[action(namespace = vim, no_json, no_register)] pub struct ReplaceCommand { @@ -73,7 +78,17 @@ pub(crate) struct Replacement { is_case_sensitive: bool, } -actions!(vim, [SearchSubmit, MoveToNextMatch, MoveToPreviousMatch]); +actions!( + vim, + [ + /// Submits the current search query. + SearchSubmit, + /// Moves to the next search match. + MoveToNextMatch, + /// Moves to the previous search match. + MoveToPreviousMatch + ] +); pub(crate) fn register(editor: &mut Editor, cx: &mut Context) { Vim::action(editor, cx, Vim::move_to_next); diff --git a/crates/vim/src/normal/substitute.rs b/crates/vim/src/normal/substitute.rs index 96df61e528..a9752f2887 100644 --- a/crates/vim/src/normal/substitute.rs +++ b/crates/vim/src/normal/substitute.rs @@ -7,7 +7,15 @@ use crate::{ motion::{Motion, MotionKind}, }; -actions!(vim, [Substitute, SubstituteLine]); +actions!( + vim, + [ + /// Substitutes characters in the current selection. + Substitute, + /// Substitutes the entire line. + SubstituteLine + ] +); pub(crate) fn register(editor: &mut Editor, cx: &mut Context) { Vim::action(editor, cx, |vim, _: &Substitute, window, cx| { diff --git a/crates/vim/src/object.rs b/crates/vim/src/object.rs index 2cec4e254a..63139d7e94 100644 --- a/crates/vim/src/object.rs +++ b/crates/vim/src/object.rs @@ -46,6 +46,7 @@ pub enum Object { EntireFile, } +/// Selects a word text object. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -54,6 +55,7 @@ struct Word { ignore_punctuation: bool, } +/// Selects a subword text object. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -61,6 +63,7 @@ struct Subword { #[serde(default)] ignore_punctuation: bool, } +/// Selects text at the same indentation level. #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[action(namespace = vim)] #[serde(deny_unknown_fields)] @@ -258,25 +261,45 @@ fn find_mini_brackets( actions!( vim, [ + /// Selects a sentence text object. Sentence, + /// Selects a paragraph text object. Paragraph, + /// Selects text within single quotes. Quotes, + /// Selects text within backticks. BackQuotes, + /// Selects text within the nearest quotes (single or double). MiniQuotes, + /// Selects text within any type of quotes. AnyQuotes, + /// Selects text within double quotes. DoubleQuotes, + /// Selects text within vertical bars (pipes). VerticalBars, + /// Selects text within parentheses. Parentheses, + /// Selects text within the nearest brackets. MiniBrackets, + /// Selects text within any type of brackets. AnyBrackets, + /// Selects text within square brackets. SquareBrackets, + /// Selects text within curly brackets. CurlyBrackets, + /// Selects text within angle brackets. AngleBrackets, + /// Selects a function argument. Argument, + /// Selects an HTML/XML tag. Tag, + /// Selects a method or function. Method, + /// Selects a class definition. Class, + /// Selects a comment block. Comment, + /// Selects the entire file. EntireFile ] ); diff --git a/crates/vim/src/replace.rs b/crates/vim/src/replace.rs index 15753e8290..aa857ef73e 100644 --- a/crates/vim/src/replace.rs +++ b/crates/vim/src/replace.rs @@ -13,7 +13,15 @@ use language::{Point, SelectionGoal}; use std::ops::Range; use std::sync::Arc; -actions!(vim, [ToggleReplace, UndoReplace]); +actions!( + vim, + [ + /// Toggles replace mode. + ToggleReplace, + /// Undoes the last replacement. + UndoReplace + ] +); pub fn register(editor: &mut Editor, cx: &mut Context) { Vim::action(editor, cx, |vim, _: &ToggleReplace, window, cx| { diff --git a/crates/vim/src/rewrap.rs b/crates/vim/src/rewrap.rs index c1d157accb..4cd9449bfa 100644 --- a/crates/vim/src/rewrap.rs +++ b/crates/vim/src/rewrap.rs @@ -4,7 +4,13 @@ use editor::{Bias, Editor, RewrapOptions, SelectionEffects, display_map::ToDispl use gpui::{Context, Window, actions}; use language::SelectionGoal; -actions!(vim, [Rewrap]); +actions!( + vim, + [ + /// Rewraps the selected text to fit within the line width. + Rewrap + ] +); pub(crate) fn register(editor: &mut Editor, cx: &mut Context) { Vim::action(editor, cx, |vim, _: &Rewrap, window, cx| { diff --git a/crates/vim/src/vim.rs b/crates/vim/src/vim.rs index 2c2d60004e..9229f145d9 100644 --- a/crates/vim/src/vim.rs +++ b/crates/vim/src/vim.rs @@ -134,55 +134,105 @@ struct PushLiteral { actions!( vim, [ + /// Switches to normal mode. SwitchToNormalMode, + /// Switches to insert mode. SwitchToInsertMode, + /// Switches to replace mode. SwitchToReplaceMode, + /// Switches to visual mode. SwitchToVisualMode, + /// Switches to visual line mode. SwitchToVisualLineMode, + /// Switches to visual block mode. SwitchToVisualBlockMode, + /// Switches to Helix-style normal mode. SwitchToHelixNormalMode, + /// Clears any pending operators. ClearOperators, + /// Clears the exchange register. ClearExchange, + /// Inserts a tab character. Tab, + /// Inserts a newline. Enter, + /// Selects inner text object. InnerObject, + /// Maximizes the current pane. MaximizePane, + /// Opens the default keymap file. OpenDefaultKeymap, + /// Resets all pane sizes to default. ResetPaneSizes, + /// Resizes the pane to the right. ResizePaneRight, + /// Resizes the pane to the left. ResizePaneLeft, + /// Resizes the pane upward. ResizePaneUp, + /// Resizes the pane downward. ResizePaneDown, + /// Starts a change operation. PushChange, + /// Starts a delete operation. PushDelete, + /// Exchanges text regions. Exchange, + /// Starts a yank operation. PushYank, + /// Starts a replace operation. PushReplace, + /// Deletes surrounding characters. PushDeleteSurrounds, + /// Sets a mark at the current position. PushMark, + /// Toggles the marks view. ToggleMarksView, + /// Starts a forced motion. PushForcedMotion, + /// Starts an indent operation. PushIndent, + /// Starts an outdent operation. PushOutdent, + /// Starts an auto-indent operation. PushAutoIndent, + /// Starts a rewrap operation. PushRewrap, + /// Starts a shell command operation. PushShellCommand, + /// Converts to lowercase. PushLowercase, + /// Converts to uppercase. PushUppercase, + /// Toggles case. PushOppositeCase, + /// Applies ROT13 encoding. PushRot13, + /// Applies ROT47 encoding. PushRot47, + /// Toggles the registers view. ToggleRegistersView, + /// Selects a register. PushRegister, + /// Starts recording to a register. PushRecordRegister, + /// Replays a register. PushReplayRegister, + /// Replaces with register contents. PushReplaceWithRegister, + /// Toggles comments. PushToggleComments, ] ); // in the workspace namespace so it's not filtered out when vim is disabled. -actions!(workspace, [ToggleVimMode,]); +actions!( + workspace, + [ + /// Toggles Vim mode on or off. + ToggleVimMode, + ] +); /// Initializes the `vim` crate. pub fn init(cx: &mut App) { diff --git a/crates/vim/src/visual.rs b/crates/vim/src/visual.rs index c3da5d2143..ca8734ba8b 100644 --- a/crates/vim/src/visual.rs +++ b/crates/vim/src/visual.rs @@ -23,23 +23,41 @@ use crate::{ actions!( vim, [ + /// Toggles visual mode. ToggleVisual, + /// Toggles visual line mode. ToggleVisualLine, + /// Toggles visual block mode. ToggleVisualBlock, + /// Deletes the visual selection. VisualDelete, + /// Deletes entire lines in visual selection. VisualDeleteLine, + /// Yanks (copies) the visual selection. VisualYank, + /// Yanks entire lines in visual selection. VisualYankLine, + /// Moves cursor to the other end of the selection. OtherEnd, + /// Moves cursor to the other end of the selection (row-aware). OtherEndRowAware, + /// Selects the next occurrence of the current selection. SelectNext, + /// Selects the previous occurrence of the current selection. SelectPrevious, + /// Selects the next match of the current selection. SelectNextMatch, + /// Selects the previous match of the current selection. SelectPreviousMatch, + /// Selects the next smaller syntax node. SelectSmallerSyntaxNode, + /// Selects the next larger syntax node. SelectLargerSyntaxNode, + /// Restores the previous visual selection. RestoreVisualSelection, + /// Inserts at the end of each line in visual selection. VisualInsertEndOfLine, + /// Inserts at the first non-whitespace character of each line. VisualInsertFirstNonWhiteSpace, ] ); diff --git a/crates/welcome/src/base_keymap_picker.rs b/crates/welcome/src/base_keymap_picker.rs index 06cda8638a..d5a6ae96da 100644 --- a/crates/welcome/src/base_keymap_picker.rs +++ b/crates/welcome/src/base_keymap_picker.rs @@ -12,7 +12,13 @@ use ui::{ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; use workspace::{ModalView, Workspace, ui::HighlightedLabel}; -actions!(welcome, [ToggleBaseKeymapSelector]); +actions!( + welcome, + [ + /// Toggles the base keymap selector modal. + ToggleBaseKeymapSelector + ] +); pub fn init(cx: &mut App) { cx.observe_new(|workspace: &mut Workspace, _window, _cx| { diff --git a/crates/welcome/src/welcome.rs b/crates/welcome/src/welcome.rs index 31b5cb4325..74d7323d8c 100644 --- a/crates/welcome/src/welcome.rs +++ b/crates/welcome/src/welcome.rs @@ -25,7 +25,13 @@ mod base_keymap_setting; mod multibuffer_hint; mod welcome_ui; -actions!(welcome, [ResetHints]); +actions!( + welcome, + [ + /// Resets the welcome screen hints to their initial state. + ResetHints + ] +); pub const FIRST_OPEN: &str = "first_open"; pub const DOCS_URL: &str = "https://zed.dev/docs/"; diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index b002d3ebe7..fccf0ef8c2 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -95,10 +95,12 @@ pub enum SaveIntent { Skip, } +/// Activates a specific item in the pane by its index. #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[action(namespace = pane)] pub struct ActivateItem(pub usize); +/// Closes the currently active item in the pane. #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[action(namespace = pane)] #[serde(deny_unknown_fields)] @@ -109,6 +111,7 @@ pub struct CloseActiveItem { pub close_pinned: bool, } +/// Closes all inactive items in the pane. #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[action(namespace = pane)] #[serde(deny_unknown_fields)] @@ -119,6 +122,7 @@ pub struct CloseInactiveItems { pub close_pinned: bool, } +/// Closes all items in the pane. #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[action(namespace = pane)] #[serde(deny_unknown_fields)] @@ -129,6 +133,7 @@ pub struct CloseAllItems { pub close_pinned: bool, } +/// Closes all items that have no unsaved changes. #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[action(namespace = pane)] #[serde(deny_unknown_fields)] @@ -137,6 +142,7 @@ pub struct CloseCleanItems { pub close_pinned: bool, } +/// Closes all items to the right of the current item. #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[action(namespace = pane)] #[serde(deny_unknown_fields)] @@ -145,6 +151,7 @@ pub struct CloseItemsToTheRight { pub close_pinned: bool, } +/// Closes all items to the left of the current item. #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[action(namespace = pane)] #[serde(deny_unknown_fields)] @@ -153,6 +160,7 @@ pub struct CloseItemsToTheLeft { pub close_pinned: bool, } +/// Reveals the current item in the project panel. #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[action(namespace = pane)] #[serde(deny_unknown_fields)] @@ -161,6 +169,7 @@ pub struct RevealInProjectPanel { pub entry_id: Option, } +/// Opens the search interface with the specified configuration. #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[action(namespace = pane)] #[serde(deny_unknown_fields)] @@ -176,25 +185,45 @@ pub struct DeploySearch { actions!( pane, [ + /// Activates the previous item in the pane. ActivatePreviousItem, + /// Activates the next item in the pane. ActivateNextItem, + /// Activates the last item in the pane. ActivateLastItem, + /// Switches to the alternate file. AlternateFile, + /// Navigates back in history. GoBack, + /// Navigates forward in history. GoForward, + /// Joins this pane into the next pane. JoinIntoNext, + /// Joins all panes into one. JoinAll, + /// Reopens the most recently closed item. ReopenClosedItem, + /// Splits the pane to the left. SplitLeft, + /// Splits the pane upward. SplitUp, + /// Splits the pane to the right. SplitRight, + /// Splits the pane downward. SplitDown, + /// Splits the pane horizontally. SplitHorizontal, + /// Splits the pane vertically. SplitVertical, + /// Swaps the current item with the one to the left. SwapItemLeft, + /// Swaps the current item with the one to the right. SwapItemRight, + /// Toggles preview mode for the current tab. TogglePreviewTab, + /// Toggles pin status for the current tab. TogglePinTab, + /// Unpins all tabs in the pane. UnpinAllTabs, ] ); diff --git a/crates/workspace/src/theme_preview.rs b/crates/workspace/src/theme_preview.rs index f9aee26cdd..03164e0a64 100644 --- a/crates/workspace/src/theme_preview.rs +++ b/crates/workspace/src/theme_preview.rs @@ -11,7 +11,13 @@ use ui::{ use crate::{Item, Workspace}; -actions!(dev, [OpenThemePreview]); +actions!( + dev, + [ + /// Opens the theme preview window. + OpenThemePreview + ] +); pub fn init(cx: &mut App) { cx.observe_new(|workspace: &mut Workspace, _, _| { diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 95e0a4aa68..91d0a20178 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -169,44 +169,83 @@ pub trait DebuggerProvider { actions!( workspace, [ + /// Activates the next pane in the workspace. ActivateNextPane, + /// Activates the previous pane in the workspace. ActivatePreviousPane, + /// Switches to the next window. ActivateNextWindow, + /// Switches to the previous window. ActivatePreviousWindow, + /// Adds a folder to the current project. AddFolderToProject, + /// Clears all notifications. ClearAllNotifications, + /// Closes the active dock. CloseActiveDock, + /// Closes all docks. CloseAllDocks, + /// Closes the current window. CloseWindow, + /// Opens the feedback dialog. Feedback, + /// Follows the next collaborator in the session. FollowNextCollaborator, + /// Moves the focused panel to the next position. MoveFocusedPanelToNextPosition, + /// Opens a new terminal in the center. NewCenterTerminal, + /// Creates a new file. NewFile, + /// Creates a new file in a vertical split. NewFileSplitVertical, + /// Creates a new file in a horizontal split. NewFileSplitHorizontal, + /// Opens a new search. NewSearch, + /// Opens a new terminal. NewTerminal, + /// Opens a new window. NewWindow, + /// Opens a file or directory. Open, + /// Opens multiple files. OpenFiles, + /// Opens the current location in terminal. OpenInTerminal, + /// Opens the component preview. OpenComponentPreview, + /// Reloads the active item. ReloadActiveItem, + /// Resets the active dock to its default size. ResetActiveDockSize, + /// Resets all open docks to their default sizes. ResetOpenDocksSize, + /// Saves the current file with a new name. SaveAs, + /// Saves without formatting. SaveWithoutFormat, + /// Shuts down all debug adapters. ShutdownDebugAdapters, + /// Suppresses the current notification. SuppressNotification, + /// Toggles the bottom dock. ToggleBottomDock, + /// Toggles centered layout mode. ToggleCenteredLayout, + /// Toggles the left dock. ToggleLeftDock, + /// Toggles the right dock. ToggleRightDock, + /// Toggles zoom on the active pane. ToggleZoom, + /// Stops following a collaborator. Unfollow, + /// Shows the welcome screen. Welcome, + /// Restores the banner. RestoreBanner, + /// Toggles expansion of the selected item. ToggleExpandItem, ] ); @@ -216,10 +255,12 @@ pub struct OpenPaths { pub paths: Vec, } +/// Activates a specific pane by its index. #[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)] #[action(namespace = workspace)] pub struct ActivatePane(pub usize); +/// Moves an item to a specific pane by index. #[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)] #[action(namespace = workspace)] #[serde(deny_unknown_fields)] @@ -236,6 +277,7 @@ fn default_1() -> usize { 1 } +/// Moves an item to a pane in the specified direction. #[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)] #[action(namespace = workspace)] #[serde(deny_unknown_fields)] @@ -252,6 +294,7 @@ fn default_right() -> SplitDirection { SplitDirection::Right } +/// Saves all open files in the workspace. #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Action)] #[action(namespace = workspace)] #[serde(deny_unknown_fields)] @@ -260,6 +303,7 @@ pub struct SaveAll { pub save_intent: Option, } +/// Saves the current file with the specified options. #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Action)] #[action(namespace = workspace)] #[serde(deny_unknown_fields)] @@ -268,6 +312,7 @@ pub struct Save { pub save_intent: Option, } +/// Closes all items and panes in the workspace. #[derive(Clone, PartialEq, Debug, Deserialize, Default, JsonSchema, Action)] #[action(namespace = workspace)] #[serde(deny_unknown_fields)] @@ -276,6 +321,7 @@ pub struct CloseAllItemsAndPanes { pub save_intent: Option, } +/// Closes all inactive tabs and panes in the workspace. #[derive(Clone, PartialEq, Debug, Deserialize, Default, JsonSchema, Action)] #[action(namespace = workspace)] #[serde(deny_unknown_fields)] @@ -284,10 +330,12 @@ pub struct CloseInactiveTabsAndPanes { pub save_intent: Option, } +/// Sends a sequence of keystrokes to the active element. #[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)] #[action(namespace = workspace)] pub struct SendKeystrokes(pub String); +/// Reloads the active item or workspace. #[derive(Clone, Deserialize, PartialEq, Default, JsonSchema, Action)] #[action(namespace = workspace)] #[serde(deny_unknown_fields)] @@ -298,11 +346,13 @@ pub struct Reload { actions!( project_symbols, [ + /// Toggles the project symbols search. #[action(name = "Toggle")] ToggleProjectSymbols ] ); +/// Toggles the file finder interface. #[derive(Default, PartialEq, Eq, Clone, Deserialize, JsonSchema, Action)] #[action(namespace = file_finder, name = "Toggle")] #[serde(deny_unknown_fields)] @@ -354,13 +404,21 @@ pub struct DecreaseOpenDocksSize { actions!( workspace, [ + /// Activates the pane to the left. ActivatePaneLeft, + /// Activates the pane to the right. ActivatePaneRight, + /// Activates the pane above. ActivatePaneUp, + /// Activates the pane below. ActivatePaneDown, + /// Swaps the current pane with the one to the left. SwapPaneLeft, + /// Swaps the current pane with the one to the right. SwapPaneRight, + /// Swaps the current pane with the one above. SwapPaneUp, + /// Swaps the current pane with the one below. SwapPaneDown, ] ); @@ -416,6 +474,7 @@ impl PartialEq for Toast { } } +/// Opens a new terminal with the specified working directory. #[derive(Debug, Default, Clone, Deserialize, PartialEq, JsonSchema, Action)] #[action(namespace = workspace)] #[serde(deny_unknown_fields)] @@ -6677,14 +6736,25 @@ actions!( /// can be copied via "Copy link to section" in the context menu of the channel notes /// buffer. These URLs look like `https://zed.dev/channel/channel-name-CHANNEL_ID/notes`. OpenChannelNotes, + /// Mutes your microphone. Mute, + /// Deafens yourself (mute both microphone and speakers). Deafen, + /// Leaves the current call. LeaveCall, + /// Shares the current project with collaborators. ShareProject, + /// Shares your screen with collaborators. ScreenShare ] ); -actions!(zed, [OpenLog]); +actions!( + zed, + [ + /// Opens the Zed log file. + OpenLog + ] +); async fn join_channel_internal( channel_id: ChannelId, diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 144df2d50e..89d9c2edf1 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -1368,6 +1368,7 @@ fn dump_all_gpui_actions() { name: &'static str, human_name: String, aliases: &'static [&'static str], + documentation: Option<&'static str>, } let mut actions = gpui::generate_list_of_all_registered_actions() .into_iter() @@ -1375,6 +1376,7 @@ fn dump_all_gpui_actions() { name: action.name, human_name: command_palette::humanize_action_name(action.name), aliases: action.deprecated_aliases, + documentation: action.documentation, }) .collect::>(); diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 944e6b26af..10fdcf34a6 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -78,19 +78,33 @@ use zed_actions::{ actions!( zed, [ + /// Opens the element inspector for debugging UI. DebugElements, + /// Hides the application window. Hide, + /// Hides all other application windows. HideOthers, + /// Minimizes the current window. Minimize, + /// Opens the default settings file. OpenDefaultSettings, + /// Opens project-specific settings. OpenProjectSettings, + /// Opens the project tasks configuration. OpenProjectTasks, + /// Opens the tasks panel. OpenTasks, + /// Opens debug tasks configuration. OpenDebugTasks, + /// Resets the application database. ResetDatabase, + /// Shows all hidden windows. ShowAll, + /// Toggles fullscreen mode. ToggleFullScreen, + /// Zooms the window. Zoom, + /// Triggers a test panic for debugging. TestPanic, ] ); diff --git a/crates/zed_actions/src/lib.rs b/crates/zed_actions/src/lib.rs index fa852084d6..ffe232ad7b 100644 --- a/crates/zed_actions/src/lib.rs +++ b/crates/zed_actions/src/lib.rs @@ -11,6 +11,7 @@ use serde::{Deserialize, Serialize}; // https://github.com/mmastrac/rust-ctor/issues/280 pub fn init() {} +/// Opens a URL in the system's default web browser. #[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)] #[action(namespace = zed)] #[serde(deny_unknown_fields)] @@ -18,6 +19,7 @@ pub struct OpenBrowser { pub url: String, } +/// Opens a zed:// URL within the application. #[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)] #[action(namespace = zed)] #[serde(deny_unknown_fields)] @@ -28,15 +30,25 @@ pub struct OpenZedUrl { actions!( zed, [ + /// Opens the settings editor. OpenSettings, + /// Opens the default keymap file. OpenDefaultKeymap, + /// Opens account settings. OpenAccountSettings, + /// Opens server settings. OpenServerSettings, + /// Quits the application. Quit, + /// Opens the user keymap file. OpenKeymap, + /// Shows information about Zed. About, + /// Opens the documentation website. OpenDocs, + /// Views open source licenses. OpenLicenses, + /// Opens the telemetry log. OpenTelemetryLog, ] ); @@ -56,6 +68,7 @@ pub enum ExtensionCategoryFilter { DebugAdapters, } +/// Opens the extensions management interface. #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[action(namespace = zed)] #[serde(deny_unknown_fields)] @@ -65,6 +78,7 @@ pub struct Extensions { pub category_filter: Option, } +/// Decreases the font size in the editor buffer. #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[action(namespace = zed)] #[serde(deny_unknown_fields)] @@ -73,6 +87,7 @@ pub struct DecreaseBufferFontSize { pub persist: bool, } +/// Increases the font size in the editor buffer. #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[action(namespace = zed)] #[serde(deny_unknown_fields)] @@ -81,6 +96,7 @@ pub struct IncreaseBufferFontSize { pub persist: bool, } +/// Resets the buffer font size to the default value. #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[action(namespace = zed)] #[serde(deny_unknown_fields)] @@ -89,6 +105,7 @@ pub struct ResetBufferFontSize { pub persist: bool, } +/// Decreases the font size of the user interface. #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[action(namespace = zed)] #[serde(deny_unknown_fields)] @@ -97,6 +114,7 @@ pub struct DecreaseUiFontSize { pub persist: bool, } +/// Increases the font size of the user interface. #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[action(namespace = zed)] #[serde(deny_unknown_fields)] @@ -105,6 +123,7 @@ pub struct IncreaseUiFontSize { pub persist: bool, } +/// Resets the UI font size to the default value. #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[action(namespace = zed)] #[serde(deny_unknown_fields)] @@ -116,7 +135,13 @@ pub struct ResetUiFontSize { pub mod dev { use gpui::actions; - actions!(dev, [ToggleInspector]); + actions!( + dev, + [ + /// Toggles the developer inspector for debugging UI elements. + ToggleInspector + ] + ); } pub mod workspace { @@ -139,9 +164,13 @@ pub mod git { actions!( git, [ + /// Checks out a different git branch. CheckoutBranch, + /// Switches to a different git branch. Switch, + /// Selects a different repository. SelectRepo, + /// Opens the git branch selector. #[action(deprecated_aliases = ["branches::OpenRecent"])] Branch ] @@ -151,25 +180,51 @@ pub mod git { pub mod jj { use gpui::actions; - actions!(jj, [BookmarkList]); + actions!( + jj, + [ + /// Opens the Jujutsu bookmark list. + BookmarkList + ] + ); } pub mod toast { use gpui::actions; - actions!(toast, [RunAction]); + actions!( + toast, + [ + /// Runs the action associated with a toast notification. + RunAction + ] + ); } pub mod command_palette { use gpui::actions; - actions!(command_palette, [Toggle]); + actions!( + command_palette, + [ + /// Toggles the command palette. + Toggle + ] + ); } pub mod feedback { use gpui::actions; - actions!(feedback, [FileBugReport, GiveFeedback]); + actions!( + feedback, + [ + /// Opens the bug report form. + FileBugReport, + /// Opens the feedback form. + GiveFeedback + ] + ); } pub mod theme_selector { @@ -177,6 +232,7 @@ pub mod theme_selector { use schemars::JsonSchema; use serde::Deserialize; + /// Toggles the theme selector interface. #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[action(namespace = theme_selector)] #[serde(deny_unknown_fields)] @@ -191,6 +247,7 @@ pub mod icon_theme_selector { use schemars::JsonSchema; use serde::Deserialize; + /// Toggles the icon theme selector interface. #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[action(namespace = icon_theme_selector)] #[serde(deny_unknown_fields)] @@ -205,7 +262,14 @@ pub mod agent { actions!( agent, - [OpenConfiguration, OpenOnboardingModal, ResetOnboarding] + [ + /// Opens the agent configuration panel. + OpenConfiguration, + /// Opens the agent onboarding modal. + OpenOnboardingModal, + /// Resets the agent onboarding state. + ResetOnboarding + ] ); } @@ -223,8 +287,15 @@ pub mod assistant { ] ); - actions!(assistant, [ShowConfiguration]); + actions!( + assistant, + [ + /// Shows the assistant configuration panel. + ShowConfiguration + ] + ); + /// Opens the rules library for managing agent rules and prompts. #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[action(namespace = agent, deprecated_aliases = ["assistant::OpenRulesLibrary", "assistant::DeployPromptLibrary"])] #[serde(deny_unknown_fields)] @@ -233,6 +304,7 @@ pub mod assistant { pub prompt_to_select: Option, } + /// Deploys the assistant interface with the specified configuration. #[derive(Clone, Default, Deserialize, PartialEq, JsonSchema, Action)] #[action(namespace = assistant)] #[serde(deny_unknown_fields)] @@ -244,9 +316,18 @@ pub mod assistant { pub mod debugger { use gpui::actions; - actions!(debugger, [OpenOnboardingModal, ResetOnboarding]); + actions!( + debugger, + [ + /// Opens the debugger onboarding modal. + OpenOnboardingModal, + /// Resets the debugger onboarding state. + ResetOnboarding + ] + ); } +/// Opens the recent projects interface. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = projects)] #[serde(deny_unknown_fields)] @@ -255,6 +336,7 @@ pub struct OpenRecent { pub create_new_window: bool, } +/// Creates a project from a selected template. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = projects)] #[serde(deny_unknown_fields)] @@ -276,7 +358,7 @@ pub enum RevealTarget { Dock, } -/// Spawn a task with name or open tasks modal. +/// Spawns a task with name or opens tasks modal. #[derive(Debug, PartialEq, Clone, Deserialize, JsonSchema, Action)] #[action(namespace = task)] #[serde(untagged)] @@ -309,7 +391,7 @@ impl Spawn { } } -/// Rerun the last task. +/// Reruns the last task. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = task)] #[serde(deny_unknown_fields)] @@ -350,15 +432,36 @@ pub mod outline { pub static TOGGLE_OUTLINE: OnceLock = OnceLock::new(); } -actions!(zed_predict_onboarding, [OpenZedPredictOnboarding]); -actions!(git_onboarding, [OpenGitIntegrationOnboarding]); +actions!( + zed_predict_onboarding, + [ + /// Opens the Zed Predict onboarding modal. + OpenZedPredictOnboarding + ] +); +actions!( + git_onboarding, + [ + /// Opens the git integration onboarding modal. + OpenGitIntegrationOnboarding + ] +); -actions!(debug_panel, [ToggleFocus]); +actions!( + debug_panel, + [ + /// Toggles focus on the debug panel. + ToggleFocus + ] +); actions!( debugger, [ + /// Toggles the enabled state of a breakpoint. ToggleEnableBreakpoint, + /// Removes a breakpoint. UnsetBreakpoint, + /// Opens the project debug tasks configuration. OpenProjectDebugTasks, ] ); diff --git a/crates/zeta/src/init.rs b/crates/zeta/src/init.rs index e63ac4ec3d..6411e423a4 100644 --- a/crates/zeta/src/init.rs +++ b/crates/zeta/src/init.rs @@ -10,7 +10,15 @@ use workspace::Workspace; use crate::{RateCompletionModal, onboarding_modal::ZedPredictModal}; -actions!(edit_prediction, [ResetOnboarding, RateCompletions]); +actions!( + edit_prediction, + [ + /// Resets the edit prediction onboarding state. + ResetOnboarding, + /// Opens the rate completions modal. + RateCompletions + ] +); pub fn init(cx: &mut App) { cx.observe_new(move |workspace: &mut Workspace, _, _cx| { diff --git a/crates/zeta/src/rate_completion_modal.rs b/crates/zeta/src/rate_completion_modal.rs index 811b838ebc..5a873fb8de 100644 --- a/crates/zeta/src/rate_completion_modal.rs +++ b/crates/zeta/src/rate_completion_modal.rs @@ -9,11 +9,17 @@ use workspace::{ModalView, Workspace}; actions!( zeta, [ + /// Rates the active completion with a thumbs up. ThumbsUpActiveCompletion, + /// Rates the active completion with a thumbs down. ThumbsDownActiveCompletion, + /// Navigates to the next edit in the completion history. NextEdit, + /// Navigates to the previous edit in the completion history. PreviousEdit, + /// Focuses on the completions list. FocusCompletions, + /// Previews the selected completion. PreviewCompletion, ] ); diff --git a/crates/zeta/src/zeta.rs b/crates/zeta/src/zeta.rs index 4d643c9db0..87cd1e604c 100644 --- a/crates/zeta/src/zeta.rs +++ b/crates/zeta/src/zeta.rs @@ -72,7 +72,13 @@ const MAX_EVENT_TOKENS: usize = 500; /// Maximum number of events to track. const MAX_EVENT_COUNT: usize = 16; -actions!(edit_prediction, [ClearHistory]); +actions!( + edit_prediction, + [ + /// Clears the edit prediction history. + ClearHistory + ] +); #[derive(Copy, Clone, Default, Debug, PartialEq, Eq, Hash)] pub struct InlineCompletionId(Uuid);