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 ...
This commit is contained in:
Ben Kunkle 2025-07-02 20:14:33 -05:00 committed by GitHub
parent def8bab5a8
commit 6cd4dbdea1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
96 changed files with 1467 additions and 78 deletions

View file

@ -31,7 +31,13 @@ use workspace::{StatusItemView, Workspace, item::ItemHandle};
const GIT_OPERATION_DELAY: Duration = Duration::from_millis(0); 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 { pub enum Event {
ShowStatus { ShowStatus {

View file

@ -54,42 +54,76 @@ pub use ui::preview::{all_agent_previews, get_agent_preview};
actions!( actions!(
agent, agent,
[ [
/// Creates a new text-based conversation thread.
NewTextThread, NewTextThread,
/// Toggles the context picker interface for adding files, symbols, or other context.
ToggleContextPicker, ToggleContextPicker,
/// Toggles the navigation menu for switching between threads and views.
ToggleNavigationMenu, ToggleNavigationMenu,
/// Toggles the options menu for agent settings and preferences.
ToggleOptionsMenu, ToggleOptionsMenu,
/// Deletes the recently opened thread from history.
DeleteRecentlyOpenThread, DeleteRecentlyOpenThread,
/// Toggles the profile selector for switching between agent profiles.
ToggleProfileSelector, ToggleProfileSelector,
/// Removes all added context from the current conversation.
RemoveAllContext, RemoveAllContext,
/// Expands the message editor to full size.
ExpandMessageEditor, ExpandMessageEditor,
/// Opens the conversation history view.
OpenHistory, OpenHistory,
/// Adds a context server to the configuration.
AddContextServer, AddContextServer,
/// Removes the currently selected thread.
RemoveSelectedThread, RemoveSelectedThread,
/// Starts a chat conversation with the agent.
Chat, Chat,
/// Starts a chat conversation with follow-up enabled.
ChatWithFollow, ChatWithFollow,
/// Cycles to the next inline assist suggestion.
CycleNextInlineAssist, CycleNextInlineAssist,
/// Cycles to the previous inline assist suggestion.
CyclePreviousInlineAssist, CyclePreviousInlineAssist,
/// Moves focus up in the interface.
FocusUp, FocusUp,
/// Moves focus down in the interface.
FocusDown, FocusDown,
/// Moves focus left in the interface.
FocusLeft, FocusLeft,
/// Moves focus right in the interface.
FocusRight, FocusRight,
/// Removes the currently focused context item.
RemoveFocusedContext, RemoveFocusedContext,
/// Accepts the suggested context item.
AcceptSuggestedContext, AcceptSuggestedContext,
/// Opens the active thread as a markdown file.
OpenActiveThreadAsMarkdown, OpenActiveThreadAsMarkdown,
/// Opens the agent diff view to review changes.
OpenAgentDiff, OpenAgentDiff,
/// Keeps the current suggestion or change.
Keep, Keep,
/// Rejects the current suggestion or change.
Reject, Reject,
/// Rejects all suggestions or changes.
RejectAll, RejectAll,
/// Keeps all suggestions or changes.
KeepAll, KeepAll,
/// Follows the agent's suggestions.
Follow, Follow,
/// Resets the trial upsell notification.
ResetTrialUpsell, ResetTrialUpsell,
/// Resets the trial end upsell notification.
ResetTrialEndUpsell, ResetTrialEndUpsell,
/// Continues the current thread.
ContinueThread, ContinueThread,
/// Continues the thread with burn mode enabled.
ContinueWithBurnMode, ContinueWithBurnMode,
/// Toggles burn mode for faster responses.
ToggleBurnMode, ToggleBurnMode,
] ]
); );
/// Creates a new conversation thread, optionally based on an existing thread.
#[derive(Default, Clone, PartialEq, Deserialize, JsonSchema, Action)] #[derive(Default, Clone, PartialEq, Deserialize, JsonSchema, Action)]
#[action(namespace = agent)] #[action(namespace = agent)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -98,6 +132,7 @@ pub struct NewThread {
from_thread_id: Option<ThreadId>, from_thread_id: Option<ThreadId>,
} }
/// Opens the profile management interface for configuring agent tools and settings.
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = agent)] #[action(namespace = agent)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]

View file

@ -18,6 +18,7 @@ use ui::{ListItem, ListItemSpacing, prelude::*};
actions!( actions!(
agent, agent,
[ [
/// Toggles the language model selector dropdown.
#[action(deprecated_aliases = ["assistant::ToggleModelSelector", "assistant2::ToggleModelSelector"])] #[action(deprecated_aliases = ["assistant::ToggleModelSelector", "assistant2::ToggleModelSelector"])]
ToggleModelSelector ToggleModelSelector
] ]

View file

@ -85,16 +85,24 @@ use assistant_context::{
actions!( actions!(
assistant, assistant,
[ [
/// Sends the current message to the assistant.
Assist, Assist,
/// Confirms and executes the entered slash command.
ConfirmCommand, ConfirmCommand,
/// Copies code from the assistant's response to the clipboard.
CopyCode, CopyCode,
/// Cycles between user and assistant message roles.
CycleMessageRole, CycleMessageRole,
/// Inserts the selected text into the active editor.
InsertIntoEditor, InsertIntoEditor,
/// Quotes the current selection in the assistant conversation.
QuoteSelection, QuoteSelection,
/// Splits the conversation at the current cursor position.
Split, Split,
] ]
); );
/// Inserts files that were dragged and dropped into the assistant conversation.
#[derive(PartialEq, Clone, Action)] #[derive(PartialEq, Clone, Action)]
#[action(namespace = assistant, no_json, no_register)] #[action(namespace = assistant, no_json, no_register)]
pub enum InsertDraggedFiles { pub enum InsertDraggedFiles {

View file

@ -28,7 +28,17 @@ use workspace::Workspace;
const SHOULD_SHOW_UPDATE_NOTIFICATION_KEY: &str = "auto-updater-should-show-updated-notification"; const SHOULD_SHOW_UPDATE_NOTIFICATION_KEY: &str = "auto-updater-should-show-updated-notification";
const POLL_INTERVAL: Duration = Duration::from_secs(60 * 60); 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)] #[derive(Serialize)]
struct UpdateRequestBody { struct UpdateRequestBody {

View file

@ -12,7 +12,13 @@ use workspace::Workspace;
use workspace::notifications::simple_message_notification::MessageNotification; use workspace::notifications::simple_message_notification::MessageNotification;
use workspace::notifications::{NotificationId, show_app_notification}; 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) { pub fn init(cx: &mut App) {
notify_if_app_was_updated(cx); notify_if_app_was_updated(cx);

View file

@ -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 MAX_RECONNECTION_DELAY: Duration = Duration::from_secs(10);
pub const CONNECTION_TIMEOUT: Duration = Duration::from_secs(20); 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)] #[derive(Clone, Default, Serialize, Deserialize, JsonSchema)]
pub struct ClientSettingsContent { pub struct ClientSettingsContent {

View file

@ -30,7 +30,13 @@ use workspace::{
}; };
use workspace::{item::Dedup, notifications::NotificationId}; 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) { pub fn init(cx: &mut App) {
workspace::FollowableViewRegistry::register::<ChannelView>(cx) workspace::FollowableViewRegistry::register::<ChannelView>(cx)

View file

@ -71,7 +71,13 @@ struct SerializedChatPanel {
width: Option<Pixels>, width: Option<Pixels>,
} }
actions!(chat_panel, [ToggleFocus]); actions!(
chat_panel,
[
/// Toggles focus on the chat panel.
ToggleFocus
]
);
impl ChatPanel { impl ChatPanel {
pub fn new( pub fn new(

View file

@ -44,15 +44,25 @@ use workspace::{
actions!( actions!(
collab_panel, collab_panel,
[ [
/// Toggles focus on the collaboration panel.
ToggleFocus, ToggleFocus,
/// Removes the selected channel or contact.
Remove, Remove,
/// Opens the context menu for the selected item.
Secondary, Secondary,
/// Collapses the selected channel in the tree view.
CollapseSelectedChannel, CollapseSelectedChannel,
/// Expands the selected channel in the tree view.
ExpandSelectedChannel, ExpandSelectedChannel,
/// Starts moving a channel to a new location.
StartMoveChannel, StartMoveChannel,
/// Moves the selected item to the current location.
MoveSelected, MoveSelected,
/// Inserts a space character in the filter input.
InsertSpace, InsertSpace,
/// Moves the selected channel up in the list.
MoveChannelUp, MoveChannelUp,
/// Moves the selected channel down in the list.
MoveChannelDown, MoveChannelDown,
] ]
); );

View file

@ -17,9 +17,13 @@ use workspace::{ModalView, notifications::DetachAndPromptErr};
actions!( actions!(
channel_modal, channel_modal,
[ [
/// Selects the next control in the channel modal.
SelectNextControl, SelectNextControl,
/// Toggles between invite members and manage members mode.
ToggleMode, ToggleMode,
/// Toggles admin status for the selected member.
ToggleMemberAdmin, ToggleMemberAdmin,
/// Removes the selected member from the channel.
RemoveMember RemoveMember
] ]
); );

View file

@ -74,7 +74,13 @@ pub struct NotificationPresenter {
pub can_navigate: bool, pub can_navigate: bool,
} }
actions!(notification_panel, [ToggleFocus]); actions!(
notification_panel,
[
/// Toggles focus on the notification panel.
ToggleFocus
]
);
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {
cx.observe_new(|workspace: &mut Workspace, _, _| { cx.observe_new(|workspace: &mut Workspace, _, _| {

View file

@ -46,11 +46,17 @@ pub use crate::sign_in::{CopilotCodeVerification, initiate_sign_in, reinstall_an
actions!( actions!(
copilot, copilot,
[ [
/// Requests a code completion suggestion from Copilot.
Suggest, Suggest,
/// Cycles to the next Copilot suggestion.
NextSuggestion, NextSuggestion,
/// Cycles to the previous Copilot suggestion.
PreviousSuggestion, PreviousSuggestion,
/// Reinstalls the Copilot language server.
Reinstall, Reinstall,
/// Signs in to GitHub Copilot.
SignIn, SignIn,
/// Signs out of GitHub Copilot.
SignOut SignOut
] ]
); );

View file

@ -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) { pub fn init(cx: &mut App) {
let log_store = cx.new(|cx| LogStore::new(cx)); let log_store = cx.new(|cx| LogStore::new(cx));

View file

@ -32,36 +32,67 @@ pub mod tests;
actions!( actions!(
debugger, debugger,
[ [
/// Starts a new debugging session.
Start, Start,
/// Continues execution until the next breakpoint.
Continue, Continue,
/// Detaches the debugger from the running process.
Detach, Detach,
/// Pauses the currently running program.
Pause, Pause,
/// Restarts the current debugging session.
Restart, Restart,
/// Reruns the current debugging session with the same configuration.
RerunSession, RerunSession,
/// Steps into the next function call.
StepInto, StepInto,
/// Steps over the current line.
StepOver, StepOver,
/// Steps out of the current function.
StepOut, StepOut,
/// Steps back to the previous statement.
StepBack, StepBack,
/// Stops the debugging session.
Stop, Stop,
/// Toggles whether to ignore all breakpoints.
ToggleIgnoreBreakpoints, ToggleIgnoreBreakpoints,
/// Clears all breakpoints in the project.
ClearAllBreakpoints, ClearAllBreakpoints,
/// Focuses on the debugger console panel.
FocusConsole, FocusConsole,
/// Focuses on the variables panel.
FocusVariables, FocusVariables,
/// Focuses on the breakpoint list panel.
FocusBreakpointList, FocusBreakpointList,
/// Focuses on the call stack frames panel.
FocusFrames, FocusFrames,
/// Focuses on the loaded modules panel.
FocusModules, FocusModules,
/// Focuses on the loaded sources panel.
FocusLoadedSources, FocusLoadedSources,
/// Focuses on the terminal panel.
FocusTerminal, FocusTerminal,
/// Shows the stack trace for the current thread.
ShowStackTrace, ShowStackTrace,
/// Toggles the thread picker dropdown.
ToggleThreadPicker, ToggleThreadPicker,
/// Toggles the session picker dropdown.
ToggleSessionPicker, ToggleSessionPicker,
/// Reruns the last debugging session.
#[action(deprecated_aliases = ["debugger::RerunLastSession"])] #[action(deprecated_aliases = ["debugger::RerunLastSession"])]
Rerun, Rerun,
/// Toggles expansion of the selected item in the debugger UI.
ToggleExpandItem, ToggleExpandItem,
] ]
); );
actions!(dev, [CopyDebugAdapterArguments]); actions!(
dev,
[
/// Copies debug adapter launch arguments to clipboard.
CopyDebugAdapterArguments
]
);
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {
DebuggerSettings::register(cx); DebuggerSettings::register(cx);

View file

@ -33,7 +33,12 @@ use zed_actions::{ToggleEnableBreakpoint, UnsetBreakpoint};
actions!( actions!(
debugger, 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)] #[derive(Clone, Copy, PartialEq)]
pub(crate) enum SelectedBreakpointKind { pub(crate) enum SelectedBreakpointKind {

View file

@ -23,7 +23,13 @@ use std::{cell::RefCell, ops::Range, rc::Rc, usize};
use theme::{Theme, ThemeSettings}; use theme::{Theme, ThemeSettings};
use ui::{ContextMenu, Divider, PopoverMenu, SplitButton, Tooltip, prelude::*}; use ui::{ContextMenu, Divider, PopoverMenu, SplitButton, Tooltip, prelude::*};
actions!(console, [WatchExpression]); actions!(
console,
[
/// Adds an expression to the watch list.
WatchExpression
]
);
pub struct Console { pub struct Console {
console: Entity<Editor>, console: Entity<Editor>,

View file

@ -18,12 +18,19 @@ use util::debug_panic;
actions!( actions!(
variable_list, variable_list,
[ [
/// Expands the selected variable entry to show its children.
ExpandSelectedEntry, ExpandSelectedEntry,
/// Collapses the selected variable entry to hide its children.
CollapseSelectedEntry, CollapseSelectedEntry,
/// Copies the variable name to the clipboard.
CopyVariableName, CopyVariableName,
/// Copies the variable value to the clipboard.
CopyVariableValue, CopyVariableValue,
/// Edits the value of the selected variable.
EditVariable, EditVariable,
/// Adds the selected variable to the watch list.
AddWatch, AddWatch,
/// Removes the selected variable from the watch list.
RemoveWatch, RemoveWatch,
] ]
); );

View file

@ -48,7 +48,14 @@ use workspace::{
actions!( actions!(
diagnostics, 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)] #[derive(Default)]

View file

@ -4,6 +4,7 @@ use gpui::{Action, actions};
use schemars::JsonSchema; use schemars::JsonSchema;
use util::serde::default_true; use util::serde::default_true;
/// Selects the next occurrence of the current selection.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -12,6 +13,7 @@ pub struct SelectNext {
pub replace_newest: bool, pub replace_newest: bool,
} }
/// Selects the previous occurrence of the current selection.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -20,6 +22,7 @@ pub struct SelectPrevious {
pub replace_newest: bool, pub replace_newest: bool,
} }
/// Moves the cursor to the beginning of the current line.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -30,6 +33,7 @@ pub struct MoveToBeginningOfLine {
pub stop_at_indent: bool, pub stop_at_indent: bool,
} }
/// Selects from the cursor to the beginning of the current line.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -40,6 +44,7 @@ pub struct SelectToBeginningOfLine {
pub stop_at_indent: bool, pub stop_at_indent: bool,
} }
/// Deletes from the cursor to the beginning of the current line.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -48,6 +53,7 @@ pub struct DeleteToBeginningOfLine {
pub(super) stop_at_indent: bool, pub(super) stop_at_indent: bool,
} }
/// Moves the cursor up by one page.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -56,6 +62,7 @@ pub struct MovePageUp {
pub(super) center_cursor: bool, pub(super) center_cursor: bool,
} }
/// Moves the cursor down by one page.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -64,6 +71,7 @@ pub struct MovePageDown {
pub(super) center_cursor: bool, pub(super) center_cursor: bool,
} }
/// Moves the cursor to the end of the current line.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -72,6 +80,7 @@ pub struct MoveToEndOfLine {
pub stop_at_soft_wraps: bool, pub stop_at_soft_wraps: bool,
} }
/// Selects from the cursor to the end of the current line.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -80,6 +89,7 @@ pub struct SelectToEndOfLine {
pub(super) stop_at_soft_wraps: bool, 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)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -101,6 +111,7 @@ pub enum CodeActionSource {
QuickActionBar, QuickActionBar,
} }
/// Confirms and accepts the currently selected completion suggestion.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -109,6 +120,7 @@ pub struct ConfirmCompletion {
pub item_ix: Option<usize>, pub item_ix: Option<usize>,
} }
/// Composes multiple completion suggestions into a single completion.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -117,6 +129,7 @@ pub struct ComposeCompletion {
pub item_ix: Option<usize>, pub item_ix: Option<usize>,
} }
/// Confirms and applies the currently selected code action.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -125,6 +138,7 @@ pub struct ConfirmCodeAction {
pub item_ix: Option<usize>, pub item_ix: Option<usize>,
} }
/// Toggles comment markers for the selected lines.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -135,6 +149,7 @@ pub struct ToggleComments {
pub ignore_indent: bool, pub ignore_indent: bool,
} }
/// Moves the cursor up by a specified number of lines.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -143,6 +158,7 @@ pub struct MoveUpByLines {
pub(super) lines: u32, pub(super) lines: u32,
} }
/// Moves the cursor down by a specified number of lines.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -151,6 +167,7 @@ pub struct MoveDownByLines {
pub(super) lines: u32, pub(super) lines: u32,
} }
/// Extends selection up by a specified number of lines.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -159,6 +176,7 @@ pub struct SelectUpByLines {
pub(super) lines: u32, pub(super) lines: u32,
} }
/// Extends selection down by a specified number of lines.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -167,6 +185,7 @@ pub struct SelectDownByLines {
pub(super) lines: u32, pub(super) lines: u32,
} }
/// Expands all excerpts in the editor.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -175,6 +194,7 @@ pub struct ExpandExcerpts {
pub(super) lines: u32, pub(super) lines: u32,
} }
/// Expands excerpts above the current position.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -183,6 +203,7 @@ pub struct ExpandExcerptsUp {
pub(super) lines: u32, pub(super) lines: u32,
} }
/// Expands excerpts below the current position.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -191,6 +212,7 @@ pub struct ExpandExcerptsDown {
pub(super) lines: u32, pub(super) lines: u32,
} }
/// Shows code completion suggestions at the cursor position.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -199,10 +221,12 @@ pub struct ShowCompletions {
pub(super) trigger: Option<String>, pub(super) trigger: Option<String>,
} }
/// Handles text input in the editor.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
pub struct HandleInput(pub String); pub struct HandleInput(pub String);
/// Deletes from the cursor to the end of the next word.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -211,6 +235,7 @@ pub struct DeleteToNextWordEnd {
pub ignore_newlines: bool, pub ignore_newlines: bool,
} }
/// Deletes from the cursor to the start of the previous word.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -219,10 +244,12 @@ pub struct DeleteToPreviousWordStart {
pub ignore_newlines: bool, pub ignore_newlines: bool,
} }
/// Folds all code blocks at the specified indentation level.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
pub struct FoldAtLevel(pub u32); pub struct FoldAtLevel(pub u32);
/// Spawns the nearest available task from the current cursor position.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = editor)] #[action(namespace = editor)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -238,11 +265,20 @@ pub enum UuidVersion {
V7, 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!( actions!(
go_to_line, go_to_line,
[ [
/// Toggles the go to line dialog.
#[action(name = "Toggle")] #[action(name = "Toggle")]
ToggleGoToLine ToggleGoToLine
] ]
@ -251,219 +287,430 @@ actions!(
actions!( actions!(
editor, editor,
[ [
/// Accepts the full edit prediction.
AcceptEditPrediction, AcceptEditPrediction,
/// Accepts a partial Copilot suggestion.
AcceptPartialCopilotSuggestion, AcceptPartialCopilotSuggestion,
/// Accepts a partial edit prediction.
AcceptPartialEditPrediction, AcceptPartialEditPrediction,
/// Adds a cursor above the current selection.
AddSelectionAbove, AddSelectionAbove,
/// Adds a cursor below the current selection.
AddSelectionBelow, AddSelectionBelow,
/// Applies all diff hunks in the editor.
ApplyAllDiffHunks, ApplyAllDiffHunks,
/// Applies the diff hunk at the current position.
ApplyDiffHunk, ApplyDiffHunk,
/// Deletes the character before the cursor.
Backspace, Backspace,
/// Cancels the current operation.
Cancel, Cancel,
/// Cancels the running flycheck operation.
CancelFlycheck, CancelFlycheck,
/// Cancels pending language server work.
CancelLanguageServerWork, CancelLanguageServerWork,
/// Clears flycheck results.
ClearFlycheck, ClearFlycheck,
/// Confirms the rename operation.
ConfirmRename, ConfirmRename,
/// Confirms completion by inserting at cursor.
ConfirmCompletionInsert, ConfirmCompletionInsert,
/// Confirms completion by replacing existing text.
ConfirmCompletionReplace, ConfirmCompletionReplace,
/// Navigates to the first item in the context menu.
ContextMenuFirst, ContextMenuFirst,
/// Navigates to the last item in the context menu.
ContextMenuLast, ContextMenuLast,
/// Navigates to the next item in the context menu.
ContextMenuNext, ContextMenuNext,
/// Navigates to the previous item in the context menu.
ContextMenuPrevious, ContextMenuPrevious,
/// Converts indentation from tabs to spaces.
ConvertIndentationToSpaces, ConvertIndentationToSpaces,
/// Converts indentation from spaces to tabs.
ConvertIndentationToTabs, ConvertIndentationToTabs,
/// Converts selected text to kebab-case.
ConvertToKebabCase, ConvertToKebabCase,
/// Converts selected text to lowerCamelCase.
ConvertToLowerCamelCase, ConvertToLowerCamelCase,
/// Converts selected text to lowercase.
ConvertToLowerCase, ConvertToLowerCase,
/// Toggles the case of selected text.
ConvertToOppositeCase, ConvertToOppositeCase,
/// Converts selected text to snake_case.
ConvertToSnakeCase, ConvertToSnakeCase,
/// Converts selected text to Title Case.
ConvertToTitleCase, ConvertToTitleCase,
/// Converts selected text to UpperCamelCase.
ConvertToUpperCamelCase, ConvertToUpperCamelCase,
/// Converts selected text to UPPERCASE.
ConvertToUpperCase, ConvertToUpperCase,
/// Applies ROT13 cipher to selected text.
ConvertToRot13, ConvertToRot13,
/// Applies ROT47 cipher to selected text.
ConvertToRot47, ConvertToRot47,
/// Copies selected text to the clipboard.
Copy, Copy,
/// Copies selected text to the clipboard with leading/trailing whitespace trimmed.
CopyAndTrim, CopyAndTrim,
/// Copies the current file location to the clipboard.
CopyFileLocation, CopyFileLocation,
/// Copies the highlighted text as JSON.
CopyHighlightJson, CopyHighlightJson,
/// Copies the current file name to the clipboard.
CopyFileName, CopyFileName,
/// Copies the file name without extension to the clipboard.
CopyFileNameWithoutExtension, CopyFileNameWithoutExtension,
/// Copies a permalink to the current line.
CopyPermalinkToLine, CopyPermalinkToLine,
/// Cuts selected text to the clipboard.
Cut, Cut,
/// Cuts from cursor to end of line.
CutToEndOfLine, CutToEndOfLine,
/// Deletes the character after the cursor.
Delete, Delete,
/// Deletes the current line.
DeleteLine, DeleteLine,
/// Deletes from cursor to end of line.
DeleteToEndOfLine, DeleteToEndOfLine,
/// Deletes to the end of the next subword.
DeleteToNextSubwordEnd, DeleteToNextSubwordEnd,
/// Deletes to the start of the previous subword.
DeleteToPreviousSubwordStart, DeleteToPreviousSubwordStart,
/// Displays names of all active cursors.
DisplayCursorNames, DisplayCursorNames,
/// Duplicates the current line below.
DuplicateLineDown, DuplicateLineDown,
/// Duplicates the current line above.
DuplicateLineUp, DuplicateLineUp,
/// Duplicates the current selection.
DuplicateSelection, DuplicateSelection,
/// Expands all diff hunks in the editor.
#[action(deprecated_aliases = ["editor::ExpandAllHunkDiffs"])] #[action(deprecated_aliases = ["editor::ExpandAllHunkDiffs"])]
ExpandAllDiffHunks, ExpandAllDiffHunks,
/// Expands macros recursively at cursor position.
ExpandMacroRecursively, ExpandMacroRecursively,
/// Finds all references to the symbol at cursor.
FindAllReferences, FindAllReferences,
/// Finds the next match in the search.
FindNextMatch, FindNextMatch,
/// Finds the previous match in the search.
FindPreviousMatch, FindPreviousMatch,
/// Folds the current code block.
Fold, Fold,
/// Folds all foldable regions in the editor.
FoldAll, FoldAll,
/// Folds all function bodies in the editor.
FoldFunctionBodies, FoldFunctionBodies,
/// Folds the current code block and all its children.
FoldRecursive, FoldRecursive,
/// Folds the selected ranges.
FoldSelectedRanges, FoldSelectedRanges,
/// Toggles folding at the current position.
ToggleFold, ToggleFold,
/// Toggles recursive folding at the current position.
ToggleFoldRecursive, ToggleFoldRecursive,
/// Formats the entire document.
Format, Format,
/// Formats only the selected text.
FormatSelections, FormatSelections,
/// Goes to the declaration of the symbol at cursor.
GoToDeclaration, GoToDeclaration,
/// Goes to declaration in a split pane.
GoToDeclarationSplit, GoToDeclarationSplit,
/// Goes to the definition of the symbol at cursor.
GoToDefinition, GoToDefinition,
/// Goes to definition in a split pane.
GoToDefinitionSplit, GoToDefinitionSplit,
/// Goes to the next diagnostic in the file.
GoToDiagnostic, GoToDiagnostic,
/// Goes to the next diff hunk.
GoToHunk, GoToHunk,
/// Goes to the previous diff hunk.
GoToPreviousHunk, GoToPreviousHunk,
/// Goes to the implementation of the symbol at cursor.
GoToImplementation, GoToImplementation,
/// Goes to implementation in a split pane.
GoToImplementationSplit, GoToImplementationSplit,
/// Goes to the next change in the file.
GoToNextChange, GoToNextChange,
/// Goes to the parent module of the current file.
GoToParentModule, GoToParentModule,
/// Goes to the previous change in the file.
GoToPreviousChange, GoToPreviousChange,
/// Goes to the previous diagnostic in the file.
GoToPreviousDiagnostic, GoToPreviousDiagnostic,
/// Goes to the type definition of the symbol at cursor.
GoToTypeDefinition, GoToTypeDefinition,
/// Goes to type definition in a split pane.
GoToTypeDefinitionSplit, GoToTypeDefinitionSplit,
/// Scrolls down by half a page.
HalfPageDown, HalfPageDown,
/// Scrolls up by half a page.
HalfPageUp, HalfPageUp,
/// Shows hover information for the symbol at cursor.
Hover, Hover,
/// Increases indentation of selected lines.
Indent, Indent,
/// Inserts a UUID v4 at cursor position.
InsertUuidV4, InsertUuidV4,
/// Inserts a UUID v7 at cursor position.
InsertUuidV7, InsertUuidV7,
/// Joins the current line with the next line.
JoinLines, JoinLines,
/// Cuts to kill ring (Emacs-style).
KillRingCut, KillRingCut,
/// Yanks from kill ring (Emacs-style).
KillRingYank, KillRingYank,
/// Moves cursor down one line.
LineDown, LineDown,
/// Moves cursor up one line.
LineUp, LineUp,
/// Moves cursor down.
MoveDown, MoveDown,
/// Moves cursor left.
MoveLeft, MoveLeft,
/// Moves the current line down.
MoveLineDown, MoveLineDown,
/// Moves the current line up.
MoveLineUp, MoveLineUp,
/// Moves cursor right.
MoveRight, MoveRight,
/// Moves cursor to the beginning of the document.
MoveToBeginning, MoveToBeginning,
/// Moves cursor to the enclosing bracket.
MoveToEnclosingBracket, MoveToEnclosingBracket,
/// Moves cursor to the end of the document.
MoveToEnd, MoveToEnd,
/// Moves cursor to the end of the paragraph.
MoveToEndOfParagraph, MoveToEndOfParagraph,
/// Moves cursor to the end of the next subword.
MoveToNextSubwordEnd, MoveToNextSubwordEnd,
/// Moves cursor to the end of the next word.
MoveToNextWordEnd, MoveToNextWordEnd,
/// Moves cursor to the start of the previous subword.
MoveToPreviousSubwordStart, MoveToPreviousSubwordStart,
/// Moves cursor to the start of the previous word.
MoveToPreviousWordStart, MoveToPreviousWordStart,
/// Moves cursor to the start of the paragraph.
MoveToStartOfParagraph, MoveToStartOfParagraph,
/// Moves cursor to the start of the current excerpt.
MoveToStartOfExcerpt, MoveToStartOfExcerpt,
/// Moves cursor to the start of the next excerpt.
MoveToStartOfNextExcerpt, MoveToStartOfNextExcerpt,
/// Moves cursor to the end of the current excerpt.
MoveToEndOfExcerpt, MoveToEndOfExcerpt,
/// Moves cursor to the end of the previous excerpt.
MoveToEndOfPreviousExcerpt, MoveToEndOfPreviousExcerpt,
/// Moves cursor up.
MoveUp, MoveUp,
/// Inserts a new line and moves cursor to it.
Newline, Newline,
/// Inserts a new line above the current line.
NewlineAbove, NewlineAbove,
/// Inserts a new line below the current line.
NewlineBelow, NewlineBelow,
/// Navigates to the next edit prediction.
NextEditPrediction, NextEditPrediction,
/// Scrolls to the next screen.
NextScreen, NextScreen,
/// Opens the context menu at cursor position.
OpenContextMenu, OpenContextMenu,
/// Opens excerpts from the current file.
OpenExcerpts, OpenExcerpts,
/// Opens excerpts in a split pane.
OpenExcerptsSplit, OpenExcerptsSplit,
/// Opens the proposed changes editor.
OpenProposedChangesEditor, OpenProposedChangesEditor,
/// Opens documentation for the symbol at cursor.
OpenDocs, OpenDocs,
/// Opens a permalink to the current line.
OpenPermalinkToLine, OpenPermalinkToLine,
/// Opens the file whose name is selected in the editor.
#[action(deprecated_aliases = ["editor::OpenFile"])] #[action(deprecated_aliases = ["editor::OpenFile"])]
OpenSelectedFilename, OpenSelectedFilename,
/// Opens all selections in a multibuffer.
OpenSelectionsInMultibuffer, OpenSelectionsInMultibuffer,
/// Opens the URL at cursor position.
OpenUrl, OpenUrl,
/// Organizes import statements.
OrganizeImports, OrganizeImports,
/// Decreases indentation of selected lines.
Outdent, Outdent,
/// Automatically adjusts indentation based on context.
AutoIndent, AutoIndent,
/// Scrolls down by one page.
PageDown, PageDown,
/// Scrolls up by one page.
PageUp, PageUp,
/// Pastes from clipboard.
Paste, Paste,
/// Navigates to the previous edit prediction.
PreviousEditPrediction, PreviousEditPrediction,
/// Redoes the last undone edit.
Redo, Redo,
/// Redoes the last selection change.
RedoSelection, RedoSelection,
/// Renames the symbol at cursor.
Rename, Rename,
/// Restarts the language server for the current file.
RestartLanguageServer, RestartLanguageServer,
/// Reveals the current file in the system file manager.
RevealInFileManager, RevealInFileManager,
/// Reverses the order of selected lines.
ReverseLines, ReverseLines,
/// Reloads the file from disk.
ReloadFile, ReloadFile,
/// Rewraps text to fit within the preferred line length.
Rewrap, Rewrap,
/// Runs flycheck diagnostics.
RunFlycheck, RunFlycheck,
/// Scrolls the cursor to the bottom of the viewport.
ScrollCursorBottom, ScrollCursorBottom,
/// Scrolls the cursor to the center of the viewport.
ScrollCursorCenter, ScrollCursorCenter,
/// Cycles cursor position between center, top, and bottom.
ScrollCursorCenterTopBottom, ScrollCursorCenterTopBottom,
/// Scrolls the cursor to the top of the viewport.
ScrollCursorTop, ScrollCursorTop,
/// Selects all text in the editor.
SelectAll, SelectAll,
/// Selects all matches of the current selection.
SelectAllMatches, SelectAllMatches,
/// Selects to the start of the current excerpt.
SelectToStartOfExcerpt, SelectToStartOfExcerpt,
/// Selects to the start of the next excerpt.
SelectToStartOfNextExcerpt, SelectToStartOfNextExcerpt,
/// Selects to the end of the current excerpt.
SelectToEndOfExcerpt, SelectToEndOfExcerpt,
/// Selects to the end of the previous excerpt.
SelectToEndOfPreviousExcerpt, SelectToEndOfPreviousExcerpt,
/// Extends selection down.
SelectDown, SelectDown,
/// Selects the enclosing symbol.
SelectEnclosingSymbol, SelectEnclosingSymbol,
/// Selects the next larger syntax node.
SelectLargerSyntaxNode, SelectLargerSyntaxNode,
/// Extends selection left.
SelectLeft, SelectLeft,
/// Selects the current line.
SelectLine, SelectLine,
/// Extends selection down by one page.
SelectPageDown, SelectPageDown,
/// Extends selection up by one page.
SelectPageUp, SelectPageUp,
/// Extends selection right.
SelectRight, SelectRight,
/// Selects the next smaller syntax node.
SelectSmallerSyntaxNode, SelectSmallerSyntaxNode,
/// Selects to the beginning of the document.
SelectToBeginning, SelectToBeginning,
/// Selects to the end of the document.
SelectToEnd, SelectToEnd,
/// Selects to the end of the paragraph.
SelectToEndOfParagraph, SelectToEndOfParagraph,
/// Selects to the end of the next subword.
SelectToNextSubwordEnd, SelectToNextSubwordEnd,
/// Selects to the end of the next word.
SelectToNextWordEnd, SelectToNextWordEnd,
/// Selects to the start of the previous subword.
SelectToPreviousSubwordStart, SelectToPreviousSubwordStart,
/// Selects to the start of the previous word.
SelectToPreviousWordStart, SelectToPreviousWordStart,
/// Selects to the start of the paragraph.
SelectToStartOfParagraph, SelectToStartOfParagraph,
/// Extends selection up.
SelectUp, SelectUp,
/// Shows the system character palette.
ShowCharacterPalette, ShowCharacterPalette,
/// Shows edit prediction at cursor.
ShowEditPrediction, ShowEditPrediction,
/// Shows signature help for the current function.
ShowSignatureHelp, ShowSignatureHelp,
/// Shows word completions.
ShowWordCompletions, ShowWordCompletions,
/// Randomly shuffles selected lines.
ShuffleLines, ShuffleLines,
/// Navigates to the next signature in the signature help popup.
SignatureHelpNext, SignatureHelpNext,
/// Navigates to the previous signature in the signature help popup.
SignatureHelpPrevious, SignatureHelpPrevious,
/// Sorts selected lines case-insensitively.
SortLinesCaseInsensitive, SortLinesCaseInsensitive,
/// Sorts selected lines case-sensitively.
SortLinesCaseSensitive, SortLinesCaseSensitive,
/// Splits selection into individual lines.
SplitSelectionIntoLines, SplitSelectionIntoLines,
/// Stops the language server for the current file.
StopLanguageServer, StopLanguageServer,
/// Switches between source and header files.
SwitchSourceHeader, SwitchSourceHeader,
/// Inserts a tab character or indents.
Tab, Tab,
/// Removes a tab character or outdents.
Backtab, Backtab,
/// Toggles a breakpoint at the current line.
ToggleBreakpoint, ToggleBreakpoint,
/// Toggles the case of selected text.
ToggleCase, ToggleCase,
/// Disables the breakpoint at the current line.
DisableBreakpoint, DisableBreakpoint,
/// Enables the breakpoint at the current line.
EnableBreakpoint, EnableBreakpoint,
/// Edits the log message for a breakpoint.
EditLogBreakpoint, EditLogBreakpoint,
/// Toggles automatic signature help.
ToggleAutoSignatureHelp, ToggleAutoSignatureHelp,
/// Toggles inline git blame display.
ToggleGitBlameInline, ToggleGitBlameInline,
/// Opens the git commit for the blame at cursor.
OpenGitBlameCommit, OpenGitBlameCommit,
/// Toggles the diagnostics panel.
ToggleDiagnostics, ToggleDiagnostics,
/// Toggles indent guides display.
ToggleIndentGuides, ToggleIndentGuides,
/// Toggles inlay hints display.
ToggleInlayHints, ToggleInlayHints,
/// Toggles inline values display.
ToggleInlineValues, ToggleInlineValues,
/// Toggles inline diagnostics display.
ToggleInlineDiagnostics, ToggleInlineDiagnostics,
/// Toggles edit prediction feature.
ToggleEditPrediction, ToggleEditPrediction,
/// Toggles line numbers display.
ToggleLineNumbers, ToggleLineNumbers,
/// Toggles the minimap display.
ToggleMinimap, ToggleMinimap,
/// Swaps the start and end of the current selection.
SwapSelectionEnds, SwapSelectionEnds,
/// Sets a mark at the current position.
SetMark, SetMark,
/// Toggles relative line numbers display.
ToggleRelativeLineNumbers, ToggleRelativeLineNumbers,
/// Toggles diff display for selected hunks.
#[action(deprecated_aliases = ["editor::ToggleHunkDiff"])] #[action(deprecated_aliases = ["editor::ToggleHunkDiff"])]
ToggleSelectedDiffHunks, ToggleSelectedDiffHunks,
/// Toggles the selection menu.
ToggleSelectionMenu, ToggleSelectionMenu,
/// Toggles soft wrap mode.
ToggleSoftWrap, ToggleSoftWrap,
/// Toggles the tab bar display.
ToggleTabBar, ToggleTabBar,
/// Transposes characters around cursor.
Transpose, Transpose,
/// Undoes the last edit.
Undo, Undo,
/// Undoes the last selection change.
UndoSelection, UndoSelection,
/// Unfolds all folded regions.
UnfoldAll, UnfoldAll,
/// Unfolds lines at cursor.
UnfoldLines, UnfoldLines,
/// Unfolds recursively at cursor.
UnfoldRecursive, UnfoldRecursive,
/// Removes duplicate lines (case-insensitive).
UniqueLinesCaseInsensitive, UniqueLinesCaseInsensitive,
/// Removes duplicate lines (case-sensitive).
UniqueLinesCaseSensitive, UniqueLinesCaseSensitive,
] ]
); );

View file

@ -178,7 +178,13 @@ pub struct ExtensionIndexLanguageEntry {
pub grammar: Option<Arc<str>>, pub grammar: Option<Arc<str>>,
} }
actions!(zed, [ReloadExtensions]); actions!(
zed,
[
/// Reloads all installed extensions.
ReloadExtensions
]
);
pub fn init( pub fn init(
extension_host_proxy: Arc<ExtensionHostProxy>, extension_host_proxy: Arc<ExtensionHostProxy>,

View file

@ -38,7 +38,13 @@ use crate::extension_version_selector::{
ExtensionVersionSelector, ExtensionVersionSelectorDelegate, ExtensionVersionSelector, ExtensionVersionSelectorDelegate,
}; };
actions!(zed, [InstallDevExtension]); actions!(
zed,
[
/// Installs an extension from a local directory for development.
InstallDevExtension
]
);
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {
cx.observe_new(move |workspace: &mut Workspace, window, cx| { cx.observe_new(move |workspace: &mut Workspace, window, cx| {

View file

@ -11,9 +11,13 @@ pub mod system_specs;
actions!( actions!(
zed, zed,
[ [
/// Copies system specifications to the clipboard for bug reports.
CopySystemSpecsIntoClipboard, CopySystemSpecsIntoClipboard,
/// Opens email client to send feedback to Zed support.
EmailZed, EmailZed,
/// Opens the Zed repository on GitHub.
OpenZedRepo, OpenZedRepo,
/// Opens the feature request form.
RequestFeature, RequestFeature,
] ]
); );

View file

@ -47,7 +47,14 @@ use workspace::{
actions!( actions!(
file_finder, 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 { impl ModalView for FileFinder {

View file

@ -31,38 +31,64 @@ actions!(
git, git,
[ [
// per-hunk // per-hunk
/// Toggles the staged state of the hunk at cursor.
ToggleStaged, ToggleStaged,
/// Stages the current hunk and moves to the next one.
StageAndNext, StageAndNext,
/// Unstages the current hunk and moves to the next one.
UnstageAndNext, UnstageAndNext,
/// Restores the selected hunks to their original state.
#[action(deprecated_aliases = ["editor::RevertSelectedHunks"])] #[action(deprecated_aliases = ["editor::RevertSelectedHunks"])]
Restore, Restore,
// per-file // per-file
/// Shows git blame information for the current file.
#[action(deprecated_aliases = ["editor::ToggleGitBlame"])] #[action(deprecated_aliases = ["editor::ToggleGitBlame"])]
Blame, Blame,
/// Stages the current file.
StageFile, StageFile,
/// Unstages the current file.
UnstageFile, UnstageFile,
// repo-wide // repo-wide
/// Stages all changes in the repository.
StageAll, StageAll,
/// Unstages all changes in the repository.
UnstageAll, UnstageAll,
/// Restores all tracked files to their last committed state.
RestoreTrackedFiles, RestoreTrackedFiles,
/// Moves all untracked files to trash.
TrashUntrackedFiles, TrashUntrackedFiles,
/// Undoes the last commit, keeping changes in the working directory.
Uncommit, Uncommit,
/// Pushes commits to the remote repository.
Push, Push,
/// Pushes commits to a specific remote branch.
PushTo, PushTo,
/// Force pushes commits to the remote repository.
ForcePush, ForcePush,
/// Pulls changes from the remote repository.
Pull, Pull,
/// Fetches changes from the remote repository.
Fetch, Fetch,
/// Fetches changes from a specific remote.
FetchFrom, FetchFrom,
/// Creates a new commit with staged changes.
Commit, Commit,
/// Amends the last commit with staged changes.
Amend, Amend,
/// Cancels the current git operation.
Cancel, Cancel,
/// Expands the commit message editor.
ExpandCommitEditor, ExpandCommitEditor,
/// Generates a commit message using AI.
GenerateCommitMessage, GenerateCommitMessage,
/// Initializes a new git repository.
Init, Init,
/// Opens all modified files in the editor.
OpenModifiedFiles, OpenModifiedFiles,
] ]
); );
/// Restores a file to its last committed state, discarding local changes.
#[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)] #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)]
#[action(namespace = git, deprecated_aliases = ["editor::RevertFile"])] #[action(namespace = git, deprecated_aliases = ["editor::RevertFile"])]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]

View file

@ -77,11 +77,17 @@ use zed_llm_client::CompletionIntent;
actions!( actions!(
git_panel, git_panel,
[ [
/// Closes the git panel.
Close, Close,
/// Toggles focus on the git panel.
ToggleFocus, ToggleFocus,
/// Opens the git panel menu.
OpenMenu, OpenMenu,
/// Focuses on the commit message editor.
FocusEditor, FocusEditor,
/// Focuses on the changes list.
FocusChanges, FocusChanges,
/// Toggles automatic co-author suggestions.
ToggleFillCoAuthors, ToggleFillCoAuthors,
] ]
); );

View file

@ -31,7 +31,13 @@ pub mod project_diff;
pub(crate) mod remote_output; pub(crate) mod remote_output;
pub mod repository_selector; 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) { pub fn init(cx: &mut App) {
GitPanelSettings::register(cx); GitPanelSettings::register(cx);

View file

@ -41,7 +41,15 @@ use workspace::{
searchable::SearchableItemHandle, 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 { pub struct ProjectDiff {
project: Entity<Project>, project: Entity<Project>,

View file

@ -150,6 +150,15 @@ pub trait Action: Any + Send {
{ {
None 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 { impl std::fmt::Debug for dyn Action {
@ -254,6 +263,7 @@ pub struct MacroActionData {
pub json_schema: fn(&mut schemars::SchemaGenerator) -> Option<schemars::Schema>, pub json_schema: fn(&mut schemars::SchemaGenerator) -> Option<schemars::Schema>,
pub deprecated_aliases: &'static [&'static str], pub deprecated_aliases: &'static [&'static str],
pub deprecation_message: Option<&'static str>, pub deprecation_message: Option<&'static str>,
pub documentation: Option<&'static str>,
} }
inventory::collect!(MacroActionBuilder); inventory::collect!(MacroActionBuilder);
@ -276,6 +286,7 @@ impl ActionRegistry {
json_schema: A::action_json_schema, json_schema: A::action_json_schema,
deprecated_aliases: A::deprecated_aliases(), deprecated_aliases: A::deprecated_aliases(),
deprecation_message: A::deprecation_message(), deprecation_message: A::deprecation_message(),
documentation: A::documentation(),
}); });
} }

View file

@ -14,6 +14,7 @@ pub(crate) fn derive_action(input: TokenStream) -> TokenStream {
let mut no_register = false; let mut no_register = false;
let mut namespace = None; let mut namespace = None;
let mut deprecated = None; let mut deprecated = None;
let mut doc_str: Option<String> = None;
for attr in &input.attrs { for attr in &input.attrs {
if attr.path().is_ident("action") { if attr.path().is_ident("action") {
@ -74,6 +75,22 @@ pub(crate) fn derive_action(input: TokenStream) -> TokenStream {
Ok(()) Ok(())
}) })
.unwrap_or_else(|e| panic!("in #[action] attribute: {}", e)); .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 } 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 { let registration = if no_register {
quote! {} quote! {}
} else { } else {
@ -171,6 +195,10 @@ pub(crate) fn derive_action(input: TokenStream) -> TokenStream {
fn deprecation_message() -> Option<&'static str> { fn deprecation_message() -> Option<&'static str> {
#deprecation_fn_body #deprecation_fn_body
} }
fn documentation() -> Option<&'static str> {
#documentation_fn_body
}
} }
}) })
} }

View file

@ -34,6 +34,7 @@ pub(crate) fn generate_register_action(type_name: &Ident) -> TokenStream2 {
json_schema: <#type_name as gpui::Action>::action_json_schema, json_schema: <#type_name as gpui::Action>::action_json_schema,
deprecated_aliases: <#type_name as gpui::Action>::deprecated_aliases(), deprecated_aliases: <#type_name as gpui::Action>::deprecated_aliases(),
deprecation_message: <#type_name as gpui::Action>::deprecation_message(), deprecation_message: <#type_name as gpui::Action>::deprecation_message(),
documentation: <#type_name as gpui::Action>::documentation(),
} }
} }

View file

@ -37,7 +37,13 @@ use zed_actions::OpenBrowser;
use zed_llm_client::UsageLimit; use zed_llm_client::UsageLimit;
use zeta::RateCompletions; 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"; const COPILOT_SETTINGS_URL: &str = "https://github.com/settings/copilot";

View file

@ -8,7 +8,15 @@ use util::ResultExt;
use workspace::notifications::{DetachAndPromptErr, NotificationId}; use workspace::notifications::{DetachAndPromptErr, NotificationId};
use workspace::{Toast, Workspace}; 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<PathBuf> { async fn install_script(cx: &AsyncApp) -> Result<PathBuf> {
let cli_path = cx.update(|cx| cx.path_for_auxiliary_executable("cli"))??; let cli_path = cx.update(|cx| cx.path_for_auxiliary_executable("cli"))??;

View file

@ -13,7 +13,13 @@ use std::{
}; };
use workspace::{AppState, OpenVisible, Workspace}; use workspace::{AppState, OpenVisible, Workspace};
actions!(journal, [NewJournalEntry]); actions!(
journal,
[
/// Creates a new journal entry for today.
NewJournalEntry
]
);
/// Settings specific to journaling /// Settings specific to journaling
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)] #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]

View file

@ -19,7 +19,13 @@ use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*};
use util::ResultExt; use util::ResultExt;
use workspace::{ModalView, Workspace}; use workspace::{ModalView, Workspace};
actions!(language_selector, [Toggle]); actions!(
language_selector,
[
/// Toggles the language selector modal.
Toggle
]
);
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {
cx.observe_new(LanguageSelector::register).detach(); cx.observe_new(LanguageSelector::register).detach();

View file

@ -13,7 +13,13 @@ use ui::{
}; };
use workspace::{Item, SplitDirection, Workspace}; 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) { pub fn init(cx: &mut App) {
cx.observe_new(|workspace: &mut Workspace, _, _| { cx.observe_new(|workspace: &mut Workspace, _, _| {

View file

@ -204,7 +204,13 @@ pub(crate) struct LogMenuItem {
pub server_kind: LanguageServerKind, pub server_kind: LanguageServerKind,
} }
actions!(dev, [OpenLanguageServerLogs]); actions!(
dev,
[
/// Opens the language server protocol logs viewer.
OpenLanguageServerLogs
]
);
pub(super) struct GlobalLogStore(pub WeakEntity<LogStore>); pub(super) struct GlobalLogStore(pub WeakEntity<LogStore>);

View file

@ -19,7 +19,13 @@ use workspace::{StatusItemView, Workspace};
use crate::lsp_log::GlobalLogStore; use crate::lsp_log::GlobalLogStore;
actions!(lsp_tool, [ToggleMenu]); actions!(
lsp_tool,
[
/// Toggles the language server tool menu.
ToggleMenu
]
);
pub struct LspTool { pub struct LspTool {
state: Entity<PickerState>, state: Entity<PickerState>,

View file

@ -15,7 +15,13 @@ use workspace::{
item::{Item, ItemHandle}, item::{Item, ItemHandle},
}; };
actions!(dev, [OpenSyntaxTreeView]); actions!(
dev,
[
/// Opens the syntax tree view for the current file.
OpenSyntaxTreeView
]
);
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {
cx.observe_new(|workspace: &mut Workspace, _, _| { cx.observe_new(|workspace: &mut Workspace, _, _| {

View file

@ -141,7 +141,15 @@ pub type CodeBlockRenderFn = Arc<
pub type CodeBlockTransformFn = pub type CodeBlockTransformFn =
Arc<dyn Fn(AnyDiv, Range<usize>, CodeBlockMetadata, &mut Window, &App) -> AnyDiv>; Arc<dyn Fn(AnyDiv, Range<usize>, 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 { impl Markdown {
pub fn new( pub fn new(

View file

@ -9,10 +9,15 @@ pub mod markdown_renderer;
actions!( actions!(
markdown, markdown,
[ [
/// Scrolls up by one page in the markdown preview.
MovePageUp, MovePageUp,
/// Scrolls down by one page in the markdown preview.
MovePageDown, MovePageDown,
/// Opens a markdown preview for the current file.
OpenPreview, OpenPreview,
/// Opens a markdown preview in a split pane.
OpenPreviewToTheSide, OpenPreviewToTheSide,
/// Opens a following markdown preview that syncs with the editor.
OpenFollowingPreview OpenFollowingPreview
] ]
); );

View file

@ -12,13 +12,21 @@ pub fn init() {}
actions!( actions!(
menu, menu,
[ [
/// Cancels the current menu operation.
Cancel, Cancel,
/// Confirms the selected menu item.
Confirm, Confirm,
/// Performs secondary confirmation action.
SecondaryConfirm, SecondaryConfirm,
/// Selects the previous item in the menu.
SelectPrevious, SelectPrevious,
/// Selects the next item in the menu.
SelectNext, SelectNext,
/// Selects the first item in the menu.
SelectFirst, SelectFirst,
/// Selects the last item in the menu.
SelectLast, SelectLast,
/// Restarts the menu from the beginning.
Restart, Restart,
EndSlot, EndSlot,
] ]

View file

@ -65,17 +65,28 @@ use worktree::{Entry, ProjectEntryId, WorktreeId};
actions!( actions!(
outline_panel, outline_panel,
[ [
/// Collapses all entries in the outline tree.
CollapseAllEntries, CollapseAllEntries,
/// Collapses the currently selected entry.
CollapseSelectedEntry, CollapseSelectedEntry,
/// Expands all entries in the outline tree.
ExpandAllEntries, ExpandAllEntries,
/// Expands the currently selected entry.
ExpandSelectedEntry, ExpandSelectedEntry,
/// Folds the selected directory.
FoldDirectory, FoldDirectory,
/// Opens the selected entry in the editor.
OpenSelectedEntry, OpenSelectedEntry,
/// Reveals the selected item in the system file manager.
RevealInFileManager, RevealInFileManager,
/// Selects the parent of the current entry.
SelectParent, SelectParent,
/// Toggles the pin status of the active editor.
ToggleActiveEditorPin, ToggleActiveEditorPin,
ToggleFocus, /// Unfolds the selected directory.
UnfoldDirectory, UnfoldDirectory,
/// Toggles focus on the outline panel.
ToggleFocus,
] ]
); );

View file

@ -5,7 +5,15 @@ use settings::Settings;
use theme::ThemeSettings; use theme::ThemeSettings;
use ui::{Tab, prelude::*}; 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 { pub trait PanelHeader: workspace::Panel {
fn header_height(&self, cx: &mut App) -> Pixels { fn header_height(&self, cx: &mut App) -> Pixels {

View file

@ -34,7 +34,13 @@ pub enum Direction {
Down, 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, /// 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. /// performing some kind of action on it.

View file

@ -21,7 +21,13 @@ pub fn init(cx: &mut App) {
extension::init(cx); extension::init(cx);
} }
actions!(context_server, [Restart]); actions!(
context_server,
[
/// Restarts the context server.
Restart
]
);
#[derive(Debug, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ContextServerStatus { pub enum ContextServerStatus {

View file

@ -181,6 +181,7 @@ struct EntryDetails {
canonical_path: Option<Arc<Path>>, canonical_path: Option<Arc<Path>>,
} }
/// Permanently deletes the selected file or directory.
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = project_panel)] #[action(namespace = project_panel)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -189,6 +190,7 @@ struct Delete {
pub skip_prompt: bool, pub skip_prompt: bool,
} }
/// Moves the selected file or directory to the system trash.
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = project_panel)] #[action(namespace = project_panel)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -200,32 +202,59 @@ struct Trash {
actions!( actions!(
project_panel, project_panel,
[ [
/// Expands the selected entry in the project tree.
ExpandSelectedEntry, ExpandSelectedEntry,
/// Collapses the selected entry in the project tree.
CollapseSelectedEntry, CollapseSelectedEntry,
/// Collapses all entries in the project tree.
CollapseAllEntries, CollapseAllEntries,
/// Creates a new directory.
NewDirectory, NewDirectory,
/// Creates a new file.
NewFile, NewFile,
/// Copies the selected file or directory.
Copy, Copy,
/// Duplicates the selected file or directory.
Duplicate, Duplicate,
/// Reveals the selected item in the system file manager.
RevealInFileManager, RevealInFileManager,
/// Removes the selected folder from the project.
RemoveFromProject, RemoveFromProject,
/// Opens the selected file with the system's default application.
OpenWithSystem, OpenWithSystem,
/// Cuts the selected file or directory.
Cut, Cut,
/// Pastes the previously cut or copied item.
Paste, Paste,
/// Renames the selected file or directory.
Rename, Rename,
/// Opens the selected file in the editor.
Open, Open,
/// Opens the selected file in a permanent tab.
OpenPermanent, OpenPermanent,
/// Toggles focus on the project panel.
ToggleFocus, ToggleFocus,
/// Toggles visibility of git-ignored files.
ToggleHideGitIgnore, ToggleHideGitIgnore,
/// Starts a new search in the selected directory.
NewSearchInDirectory, NewSearchInDirectory,
/// Unfolds the selected directory.
UnfoldDirectory, UnfoldDirectory,
/// Folds the selected directory.
FoldDirectory, FoldDirectory,
/// Selects the parent directory.
SelectParent, SelectParent,
/// Selects the next entry with git changes.
SelectNextGitEntry, SelectNextGitEntry,
/// Selects the previous entry with git changes.
SelectPrevGitEntry, SelectPrevGitEntry,
/// Selects the next entry with diagnostics.
SelectNextDiagnostic, SelectNextDiagnostic,
/// Selects the previous entry with diagnostics.
SelectPrevDiagnostic, SelectPrevDiagnostic,
/// Selects the next directory.
SelectNextDirectory, SelectNextDirectory,
/// Selects the previous directory.
SelectPrevDirectory, SelectPrevDirectory,
] ]
); );

View file

@ -28,12 +28,19 @@ use nbformat::v4::Metadata as NotebookMetadata;
actions!( actions!(
notebook, notebook,
[ [
/// Opens a Jupyter notebook file.
OpenNotebook, OpenNotebook,
/// Runs all cells in the notebook.
RunAll, RunAll,
/// Clears all cell outputs.
ClearOutputs, ClearOutputs,
/// Moves the current cell up.
MoveCellUp, MoveCellUp,
/// Moves the current cell down.
MoveCellDown, MoveCellDown,
/// Adds a new markdown cell.
AddMarkdownBlock, AddMarkdownBlock,
/// Adds a new code cell.
AddCodeBlock, AddCodeBlock,
] ]
); );

View file

@ -16,13 +16,21 @@ use crate::repl_store::ReplStore;
actions!( actions!(
repl, repl,
[ [
/// Runs the current cell and advances to the next one.
Run, Run,
/// Runs the current cell without advancing.
RunInPlace, RunInPlace,
/// Clears all outputs in the REPL.
ClearOutputs, ClearOutputs,
/// Opens the REPL sessions panel.
Sessions, Sessions,
/// Interrupts the currently running kernel.
Interrupt, Interrupt,
/// Shuts down the current kernel.
Shutdown, Shutdown,
/// Restarts the current kernel.
Restart, Restart,
/// Refreshes the list of available kernelspecs.
RefreshKernelspecs RefreshKernelspecs
] ]
); );

View file

@ -37,7 +37,16 @@ pub fn init(cx: &mut App) {
actions!( actions!(
rules_library, 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!( const BUILT_IN_TOOLTIP_TEXT: &'static str = concat!(

View file

@ -46,6 +46,7 @@ use registrar::{ForDeployed, ForDismissed, SearchActionsRegistrar, WithResults};
const MAX_BUFFER_SEARCH_HISTORY_SIZE: usize = 50; const MAX_BUFFER_SEARCH_HISTORY_SIZE: usize = 50;
/// Opens the buffer search interface with the specified configuration.
#[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]
#[action(namespace = buffer_search)] #[action(namespace = buffer_search)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -58,7 +59,17 @@ pub struct Deploy {
pub selection_search_enabled: bool, 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 { impl Deploy {
pub fn find() -> Self { pub fn find() -> Self {

View file

@ -47,7 +47,16 @@ use workspace::{
actions!( actions!(
project_search, 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)] #[derive(Default)]

View file

@ -23,19 +23,35 @@ pub fn init(cx: &mut App) {
actions!( actions!(
search, search,
[ [
/// Focuses on the search input field.
FocusSearch, FocusSearch,
/// Toggles whole word matching.
ToggleWholeWord, ToggleWholeWord,
/// Toggles case-sensitive search.
ToggleCaseSensitive, ToggleCaseSensitive,
/// Toggles searching in ignored files.
ToggleIncludeIgnored, ToggleIncludeIgnored,
/// Toggles regular expression mode.
ToggleRegex, ToggleRegex,
/// Toggles the replace interface.
ToggleReplace, ToggleReplace,
/// Toggles searching within selection only.
ToggleSelection, ToggleSelection,
/// Selects the next search match.
SelectNextMatch, SelectNextMatch,
/// Selects the previous search match.
SelectPreviousMatch, SelectPreviousMatch,
/// Selects all search matches.
SelectAllMatches, SelectAllMatches,
/// Cycles through search modes.
CycleMode,
/// Navigates to the next query in search history.
NextHistoryQuery, NextHistoryQuery,
/// Navigates to the previous query in search history.
PreviousHistoryQuery, PreviousHistoryQuery,
/// Replaces all matches.
ReplaceAll, ReplaceAll,
/// Replaces the next match.
ReplaceNext, ReplaceNext,
] ]
); );

View file

@ -28,10 +28,26 @@ use crate::{
ui_components::table::{Table, TableInteractionState}, ui_components::table::{Table, TableInteractionState},
}; };
actions!(zed, [OpenKeymapEditor]); actions!(
zed,
[
/// Opens the keymap editor.
OpenKeymapEditor
]
);
const KEYMAP_EDITOR_NAMESPACE: &'static str = "keymap_editor"; 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) { pub fn init(cx: &mut App) {
let keymap_event_channel = KeymapEventChannel::new(); let keymap_event_channel = KeymapEventChannel::new();

View file

@ -29,6 +29,7 @@ impl FeatureFlag for SettingsUiFeatureFlag {
const NAME: &'static str = "settings-ui"; const NAME: &'static str = "settings-ui";
} }
/// Imports settings from Visual Studio Code.
#[derive(Copy, Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)] #[derive(Copy, Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -37,6 +38,7 @@ pub struct ImportVsCodeSettings {
pub skip_prompt: bool, pub skip_prompt: bool,
} }
/// Imports settings from Cursor editor.
#[derive(Copy, Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)] #[derive(Copy, Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -44,7 +46,13 @@ pub struct ImportCursorSettings {
#[serde(default)] #[serde(default)]
pub skip_prompt: bool, pub skip_prompt: bool,
} }
actions!(zed, [OpenSettingsEditor]); actions!(
zed,
[
/// Opens the settings editor.
OpenSettingsEditor
]
);
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {
cx.on_action(|_: &OpenSettingsEditor, cx| { cx.on_action(|_: &OpenSettingsEditor, cx| {

View file

@ -54,7 +54,15 @@ impl From<ScopeFileName> 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) { pub fn init(cx: &mut App) {
cx.observe_new(register).detach(); cx.observe_new(register).detach();

View file

@ -25,7 +25,13 @@ use std::{path::PathBuf, process::Stdio, sync::Arc};
use ui::prelude::*; use ui::prelude::*;
use util::ResultExt; use util::ResultExt;
actions!(supermaven, [SignOut]); actions!(
supermaven,
[
/// Signs out of Supermaven.
SignOut
]
);
pub fn init(client: Arc<Client>, cx: &mut App) { pub fn init(client: Arc<Client>, cx: &mut App) {
let supermaven = cx.new(|_| Supermaven::Starting); let supermaven = cx.new(|_| Supermaven::Starting);

View file

@ -5,7 +5,14 @@ pub mod svg_preview_view;
actions!( actions!(
svg, 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) { pub fn init(cx: &mut App) {

View file

@ -25,6 +25,7 @@ use workspace::{
const PANEL_WIDTH_REMS: f32 = 28.; const PANEL_WIDTH_REMS: f32 = 28.;
/// Toggles the tab switcher interface.
#[derive(PartialEq, Clone, Deserialize, JsonSchema, Default, Action)] #[derive(PartialEq, Clone, Deserialize, JsonSchema, Default, Action)]
#[action(namespace = tab_switcher)] #[action(namespace = tab_switcher)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -32,7 +33,15 @@ pub struct Toggle {
#[serde(default)] #[serde(default)]
pub select_last: bool, 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 { pub struct TabSwitcher {
picker: Entity<Picker<TabSwitcherDelegate>>, picker: Entity<Picker<TabSwitcherDelegate>>,

View file

@ -73,18 +73,36 @@ use crate::mappings::{colors::to_alac_rgb, keys::to_esc_str};
actions!( actions!(
terminal, terminal,
[ [
/// Clears the terminal screen.
Clear, Clear,
/// Copies selected text to the clipboard.
Copy, Copy,
/// Pastes from the clipboard.
Paste, Paste,
/// Shows the character palette for special characters.
ShowCharacterPalette, ShowCharacterPalette,
/// Searches for text in the terminal.
SearchTest, SearchTest,
/// Scrolls up by one line.
ScrollLineUp, ScrollLineUp,
/// Scrolls down by one line.
ScrollLineDown, ScrollLineDown,
/// Scrolls up by one page.
ScrollPageUp, ScrollPageUp,
/// Scrolls down by one page.
ScrollPageDown, ScrollPageDown,
/// Scrolls up by half a page.
ScrollHalfPageUp,
/// Scrolls down by half a page.
ScrollHalfPageDown,
/// Scrolls to the top of the terminal buffer.
ScrollToTop, ScrollToTop,
/// Scrolls to the bottom of the terminal buffer.
ScrollToBottom, ScrollToBottom,
/// Toggles vi mode in the terminal.
ToggleViMode, ToggleViMode,
/// Selects all text in the terminal.
SelectAll,
] ]
); );

View file

@ -46,7 +46,13 @@ use zed_actions::assistant::InlineAssist;
const TERMINAL_PANEL_KEY: &str = "TerminalPanel"; 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) { pub fn init(cx: &mut App) {
cx.observe_new( cx.observe_new(

View file

@ -70,15 +70,23 @@ const GIT_DIFF_PATH_PREFIXES: &[&str] = &["a", "b"];
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]
pub struct ScrollTerminal(pub i32); pub struct ScrollTerminal(pub i32);
/// Sends the specified text directly to the terminal.
#[derive(Clone, Debug, Default, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Debug, Default, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = terminal)] #[action(namespace = terminal)]
pub struct SendText(String); pub struct SendText(String);
/// Sends a keystroke sequence to the terminal.
#[derive(Clone, Debug, Default, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Debug, Default, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = terminal)] #[action(namespace = terminal)]
pub struct SendKeystroke(String); pub struct SendKeystroke(String);
actions!(terminal, [RerunTask]); actions!(
terminal,
[
/// Reruns the last executed task in the terminal.
RerunTask
]
);
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {
assistant_slash_command::init(cx); assistant_slash_command::init(cx);

View file

@ -17,7 +17,13 @@ use zed_actions::{ExtensionCategoryFilter, Extensions};
use crate::icon_theme_selector::{IconThemeSelector, IconThemeSelectorDelegate}; 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) { pub fn init(cx: &mut App) {
cx.on_action(|action: &zed_actions::theme_selector::Toggle, cx| { cx.on_action(|action: &zed_actions::theme_selector::Toggle, cx| {

View file

@ -12,7 +12,15 @@ use smallvec::SmallVec;
use ui::{ContextMenu, PopoverMenu, PopoverMenuHandle, Tooltip, prelude::*}; use ui::{ContextMenu, PopoverMenu, PopoverMenuHandle, Tooltip, prelude::*};
#[cfg(not(target_os = "macos"))] #[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"))] #[cfg(not(target_os = "macos"))]
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Default, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Default, Action)]

View file

@ -11,7 +11,17 @@ use workspace::notifications::DetachAndPromptErr;
use crate::TitleBar; 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) { fn toggle_screen_sharing(_: &ToggleScreenSharing, window: &mut Window, cx: &mut App) {
let call = ActiveCall::global(cx).read(cx); let call = ActiveCall::global(cx).read(cx);

View file

@ -47,7 +47,17 @@ const MAX_PROJECT_NAME_LENGTH: usize = 40;
const MAX_BRANCH_NAME_LENGTH: usize = 40; const MAX_BRANCH_NAME_LENGTH: usize = 40;
const MAX_SHORT_SHA_LENGTH: usize = 8; 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) { pub fn init(cx: &mut App) {
TitleBarSettings::register(cx); TitleBarSettings::register(cx);

View file

@ -15,7 +15,13 @@ use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*};
use util::ResultExt; use util::ResultExt;
use workspace::{ModalView, Workspace}; use workspace::{ModalView, Workspace};
actions!(toolchain, [Select]); actions!(
toolchain,
[
/// Selects a toolchain for the current project.
Select
]
);
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {
cx.observe_new(ToolchainSelector::register).detach(); cx.observe_new(ToolchainSelector::register).detach();

View file

@ -3,7 +3,15 @@ use gpui::{Context, Window, actions};
use crate::{Vim, state::Mode}; 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>) { pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
Vim::action(editor, cx, |vim, _: &ChangeListOlder, window, cx| { Vim::action(editor, cx, |vim, _: &ChangeListOlder, window, cx| {

View file

@ -44,18 +44,21 @@ use crate::{
visual::VisualDeleteLine, visual::VisualDeleteLine,
}; };
/// Goes to the specified line number in the editor.
#[derive(Clone, Debug, PartialEq, Action)] #[derive(Clone, Debug, PartialEq, Action)]
#[action(namespace = vim, no_json, no_register)] #[action(namespace = vim, no_json, no_register)]
pub struct GoToLine { pub struct GoToLine {
range: CommandRange, range: CommandRange,
} }
/// Yanks (copies) text based on the specified range.
#[derive(Clone, Debug, PartialEq, Action)] #[derive(Clone, Debug, PartialEq, Action)]
#[action(namespace = vim, no_json, no_register)] #[action(namespace = vim, no_json, no_register)]
pub struct YankCommand { pub struct YankCommand {
range: CommandRange, range: CommandRange,
} }
/// Executes a command with the specified range.
#[derive(Clone, Debug, PartialEq, Action)] #[derive(Clone, Debug, PartialEq, Action)]
#[action(namespace = vim, no_json, no_register)] #[action(namespace = vim, no_json, no_register)]
pub struct WithRange { pub struct WithRange {
@ -64,6 +67,7 @@ pub struct WithRange {
action: WrappedAction, action: WrappedAction,
} }
/// Executes a command with the specified count.
#[derive(Clone, Debug, PartialEq, Action)] #[derive(Clone, Debug, PartialEq, Action)]
#[action(namespace = vim, no_json, no_register)] #[action(namespace = vim, no_json, no_register)]
pub struct WithCount { pub struct WithCount {
@ -155,12 +159,14 @@ impl VimOption {
} }
} }
/// Sets vim options and configuration values.
#[derive(Clone, PartialEq, Action)] #[derive(Clone, PartialEq, Action)]
#[action(namespace = vim, no_json, no_register)] #[action(namespace = vim, no_json, no_register)]
pub struct VimSet { pub struct VimSet {
options: Vec<VimOption>, options: Vec<VimOption>,
} }
/// Saves the current file with optional save intent.
#[derive(Clone, PartialEq, Action)] #[derive(Clone, PartialEq, Action)]
#[action(namespace = vim, no_json, no_register)] #[action(namespace = vim, no_json, no_register)]
struct VimSave { struct VimSave {
@ -168,6 +174,7 @@ struct VimSave {
pub filename: String, pub filename: String,
} }
/// Deletes the specified marks from the editor.
#[derive(Clone, PartialEq, Action)] #[derive(Clone, PartialEq, Action)]
#[action(namespace = vim, no_json, no_register)] #[action(namespace = vim, no_json, no_register)]
enum DeleteMarks { enum DeleteMarks {
@ -177,8 +184,18 @@ enum DeleteMarks {
actions!( actions!(
vim, 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)] #[derive(Clone, PartialEq, Action)]
#[action(namespace = vim, no_json, no_register)] #[action(namespace = vim, no_json, no_register)]
struct VimEdit { struct VimEdit {
@ -1282,6 +1299,7 @@ fn generate_positions(string: &str, query: &str) -> Vec<usize> {
positions positions
} }
/// Applies a command to all lines matching a pattern.
#[derive(Debug, PartialEq, Clone, Action)] #[derive(Debug, PartialEq, Clone, Action)]
#[action(namespace = vim, no_json, no_register)] #[action(namespace = vim, no_json, no_register)]
pub(crate) struct OnMatchingLines { pub(crate) struct OnMatchingLines {
@ -1480,6 +1498,7 @@ impl OnMatchingLines {
} }
} }
/// Executes a shell command and returns the output.
#[derive(Clone, Debug, PartialEq, Action)] #[derive(Clone, Debug, PartialEq, Action)]
#[action(namespace = vim, no_json, no_register)] #[action(namespace = vim, no_json, no_register)]
pub struct ShellExec { pub struct ShellExec {

View file

@ -6,7 +6,13 @@ use text::SelectionGoal;
use crate::{Vim, motion::Motion, state::Mode}; 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>) { pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
Vim::action(editor, cx, Vim::helix_normal_after); Vim::action(editor, cx, Vim::helix_normal_after);

View file

@ -13,7 +13,17 @@ pub(crate) enum IndentDirection {
Auto, 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>) { pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
Vim::action(editor, cx, |vim, _: &Indent, window, cx| { Vim::action(editor, cx, |vim, _: &Indent, window, cx| {

View file

@ -5,7 +5,15 @@ use language::SelectionGoal;
use settings::Settings; use settings::Settings;
use vim_mode_setting::HelixModeSetting; 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>) { pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
Vim::action(editor, cx, Vim::normal_before); Vim::action(editor, cx, Vim::normal_before);

View file

@ -176,6 +176,7 @@ enum IndentType {
Same, Same,
} }
/// Moves to the start of the next word.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -184,6 +185,7 @@ struct NextWordStart {
ignore_punctuation: bool, ignore_punctuation: bool,
} }
/// Moves to the end of the next word.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -192,6 +194,7 @@ struct NextWordEnd {
ignore_punctuation: bool, ignore_punctuation: bool,
} }
/// Moves to the start of the previous word.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -200,6 +203,7 @@ struct PreviousWordStart {
ignore_punctuation: bool, ignore_punctuation: bool,
} }
/// Moves to the end of the previous word.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -208,6 +212,7 @@ struct PreviousWordEnd {
ignore_punctuation: bool, ignore_punctuation: bool,
} }
/// Moves to the start of the next subword.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -216,6 +221,7 @@ pub(crate) struct NextSubwordStart {
pub(crate) ignore_punctuation: bool, pub(crate) ignore_punctuation: bool,
} }
/// Moves to the end of the next subword.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -224,6 +230,7 @@ pub(crate) struct NextSubwordEnd {
pub(crate) ignore_punctuation: bool, pub(crate) ignore_punctuation: bool,
} }
/// Moves to the start of the previous subword.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -232,6 +239,7 @@ pub(crate) struct PreviousSubwordStart {
pub(crate) ignore_punctuation: bool, pub(crate) ignore_punctuation: bool,
} }
/// Moves to the end of the previous subword.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -240,6 +248,7 @@ pub(crate) struct PreviousSubwordEnd {
pub(crate) ignore_punctuation: bool, pub(crate) ignore_punctuation: bool,
} }
/// Moves cursor up by the specified number of lines.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -248,6 +257,7 @@ pub(crate) struct Up {
pub(crate) display_lines: bool, pub(crate) display_lines: bool,
} }
/// Moves cursor down by the specified number of lines.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -256,6 +266,7 @@ pub(crate) struct Down {
pub(crate) display_lines: bool, pub(crate) display_lines: bool,
} }
/// Moves to the first non-whitespace character on the current line.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -264,6 +275,7 @@ struct FirstNonWhitespace {
display_lines: bool, display_lines: bool,
} }
/// Moves to the end of the current line.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -272,6 +284,7 @@ struct EndOfLine {
display_lines: bool, display_lines: bool,
} }
/// Moves to the start of the current line.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -280,6 +293,7 @@ pub struct StartOfLine {
pub(crate) display_lines: bool, pub(crate) display_lines: bool,
} }
/// Moves to the middle of the current line.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -288,6 +302,7 @@ struct MiddleOfLine {
display_lines: bool, display_lines: bool,
} }
/// Finds the next unmatched bracket or delimiter.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -296,6 +311,7 @@ struct UnmatchedForward {
char: char, char: char,
} }
/// Finds the previous unmatched bracket or delimiter.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -307,46 +323,85 @@ struct UnmatchedBackward {
actions!( actions!(
vim, vim,
[ [
/// Moves cursor left one character.
Left, Left,
/// Moves cursor left one character, wrapping to previous line.
#[action(deprecated_aliases = ["vim::Backspace"])] #[action(deprecated_aliases = ["vim::Backspace"])]
WrappingLeft, WrappingLeft,
/// Moves cursor right one character.
Right, Right,
/// Moves cursor right one character, wrapping to next line.
#[action(deprecated_aliases = ["vim::Space"])] #[action(deprecated_aliases = ["vim::Space"])]
WrappingRight, WrappingRight,
/// Selects the current line.
CurrentLine, CurrentLine,
/// Moves to the start of the next sentence.
SentenceForward, SentenceForward,
/// Moves to the start of the previous sentence.
SentenceBackward, SentenceBackward,
/// Moves to the start of the paragraph.
StartOfParagraph, StartOfParagraph,
/// Moves to the end of the paragraph.
EndOfParagraph, EndOfParagraph,
/// Moves to the start of the document.
StartOfDocument, StartOfDocument,
/// Moves to the end of the document.
EndOfDocument, EndOfDocument,
/// Moves to the matching bracket or delimiter.
Matching, Matching,
/// Goes to a percentage position in the file.
GoToPercentage, GoToPercentage,
/// Moves to the start of the next line.
NextLineStart, NextLineStart,
/// Moves to the start of the previous line.
PreviousLineStart, PreviousLineStart,
/// Moves to the start of a line downward.
StartOfLineDownward, StartOfLineDownward,
/// Moves to the end of a line downward.
EndOfLineDownward, EndOfLineDownward,
/// Goes to a specific column number.
GoToColumn, GoToColumn,
/// Repeats the last character find.
RepeatFind, RepeatFind,
/// Repeats the last character find in reverse.
RepeatFindReversed, RepeatFindReversed,
/// Moves to the top of the window.
WindowTop, WindowTop,
/// Moves to the middle of the window.
WindowMiddle, WindowMiddle,
/// Moves to the bottom of the window.
WindowBottom, WindowBottom,
/// Moves to the start of the next section.
NextSectionStart, NextSectionStart,
/// Moves to the end of the next section.
NextSectionEnd, NextSectionEnd,
/// Moves to the start of the previous section.
PreviousSectionStart, PreviousSectionStart,
/// Moves to the end of the previous section.
PreviousSectionEnd, PreviousSectionEnd,
/// Moves to the start of the next method.
NextMethodStart, NextMethodStart,
/// Moves to the end of the next method.
NextMethodEnd, NextMethodEnd,
/// Moves to the start of the previous method.
PreviousMethodStart, PreviousMethodStart,
/// Moves to the end of the previous method.
PreviousMethodEnd, PreviousMethodEnd,
/// Moves to the next comment.
NextComment, NextComment,
/// Moves to the previous comment.
PreviousComment, PreviousComment,
/// Moves to the previous line with lesser indentation.
PreviousLesserIndent, PreviousLesserIndent,
/// Moves to the previous line with greater indentation.
PreviousGreaterIndent, PreviousGreaterIndent,
/// Moves to the previous line with the same indentation.
PreviousSameIndent, PreviousSameIndent,
/// Moves to the next line with lesser indentation.
NextLesserIndent, NextLesserIndent,
/// Moves to the next line with greater indentation.
NextGreaterIndent, NextGreaterIndent,
/// Moves to the next line with the same indentation.
NextSameIndent, NextSameIndent,
] ]
); );

View file

@ -36,32 +36,59 @@ use multi_buffer::MultiBufferRow;
actions!( actions!(
vim, vim,
[ [
/// Inserts text after the cursor.
InsertAfter, InsertAfter,
/// Inserts text before the cursor.
InsertBefore, InsertBefore,
/// Inserts at the first non-whitespace character.
InsertFirstNonWhitespace, InsertFirstNonWhitespace,
/// Inserts at the end of the line.
InsertEndOfLine, InsertEndOfLine,
/// Inserts a new line above the current line.
InsertLineAbove, InsertLineAbove,
/// Inserts a new line below the current line.
InsertLineBelow, InsertLineBelow,
/// Inserts an empty line above without entering insert mode.
InsertEmptyLineAbove, InsertEmptyLineAbove,
/// Inserts an empty line below without entering insert mode.
InsertEmptyLineBelow, InsertEmptyLineBelow,
/// Inserts at the previous insert position.
InsertAtPrevious, InsertAtPrevious,
/// Joins the current line with the next line.
JoinLines, JoinLines,
/// Joins lines without adding whitespace.
JoinLinesNoWhitespace, JoinLinesNoWhitespace,
/// Deletes character to the left.
DeleteLeft, DeleteLeft,
/// Deletes character to the right.
DeleteRight, DeleteRight,
/// Deletes using Helix-style behavior.
HelixDelete, HelixDelete,
/// Changes from cursor to end of line.
ChangeToEndOfLine, ChangeToEndOfLine,
/// Deletes from cursor to end of line.
DeleteToEndOfLine, DeleteToEndOfLine,
/// Yanks (copies) the selected text.
Yank, Yank,
/// Yanks the entire line.
YankLine, YankLine,
/// Toggles the case of selected text.
ChangeCase, ChangeCase,
/// Converts selected text to uppercase.
ConvertToUpperCase, ConvertToUpperCase,
/// Converts selected text to lowercase.
ConvertToLowerCase, ConvertToLowerCase,
/// Applies ROT13 cipher to selected text.
ConvertToRot13, ConvertToRot13,
/// Applies ROT47 cipher to selected text.
ConvertToRot47, ConvertToRot47,
/// Toggles comments for selected lines.
ToggleComments, ToggleComments,
/// Shows the current location in the file.
ShowLocation, ShowLocation,
/// Undoes the last change.
Undo, Undo,
/// Redoes the last undone change.
Redo, Redo,
] ]
); );

View file

@ -9,6 +9,7 @@ use crate::{Vim, state::Mode};
const BOOLEAN_PAIRS: &[(&str, &str)] = &[("true", "false"), ("yes", "no"), ("on", "off")]; 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)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -17,6 +18,7 @@ struct Increment {
step: bool, step: bool,
} }
/// Decrements the number under the cursor or toggles boolean values.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]

View file

@ -14,6 +14,7 @@ use crate::{
state::{Mode, Register}, state::{Mode, Register},
}; };
/// Pastes text from the specified register at the cursor position.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]

View file

@ -11,7 +11,19 @@ use editor::Editor;
use gpui::{Action, App, Context, Window, actions}; use gpui::{Action, App, Context, Window, actions};
use workspace::Workspace; 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 { fn should_replay(action: &dyn Action) -> bool {
// skip so that we don't leave the character palette open // skip so that we don't leave the character palette open

View file

@ -11,13 +11,21 @@ use settings::Settings;
actions!( actions!(
vim, vim,
[ [
/// Scrolls up by one line.
LineUp, LineUp,
/// Scrolls down by one line.
LineDown, LineDown,
/// Scrolls right by one column.
ColumnRight, ColumnRight,
/// Scrolls left by one column.
ColumnLeft, ColumnLeft,
/// Scrolls up by half a page.
ScrollUp, ScrollUp,
/// Scrolls down by half a page.
ScrollDown, ScrollDown,
/// Scrolls up by one page.
PageUp, PageUp,
/// Scrolls down by one page.
PageDown PageDown
] ]
); );

View file

@ -16,6 +16,7 @@ use crate::{
state::{Mode, SearchState}, state::{Mode, SearchState},
}; };
/// Moves to the next search match.
#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -28,6 +29,7 @@ pub(crate) struct MoveToNext {
regex: bool, regex: bool,
} }
/// Moves to the previous search match.
#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -40,6 +42,7 @@ pub(crate) struct MoveToPrevious {
regex: bool, regex: bool,
} }
/// Initiates a search operation with the specified parameters.
#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -50,6 +53,7 @@ pub(crate) struct Search {
regex: bool, regex: bool,
} }
/// Executes a find command to search for patterns in the buffer.
#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -58,6 +62,7 @@ pub struct FindCommand {
pub backwards: bool, pub backwards: bool,
} }
/// Executes a search and replace command within the specified range.
#[derive(Clone, Debug, PartialEq, Action)] #[derive(Clone, Debug, PartialEq, Action)]
#[action(namespace = vim, no_json, no_register)] #[action(namespace = vim, no_json, no_register)]
pub struct ReplaceCommand { pub struct ReplaceCommand {
@ -73,7 +78,17 @@ pub(crate) struct Replacement {
is_case_sensitive: bool, 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>) { pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
Vim::action(editor, cx, Vim::move_to_next); Vim::action(editor, cx, Vim::move_to_next);

View file

@ -7,7 +7,15 @@ use crate::{
motion::{Motion, MotionKind}, 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>) { pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
Vim::action(editor, cx, |vim, _: &Substitute, window, cx| { Vim::action(editor, cx, |vim, _: &Substitute, window, cx| {

View file

@ -46,6 +46,7 @@ pub enum Object {
EntireFile, EntireFile,
} }
/// Selects a word text object.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -54,6 +55,7 @@ struct Word {
ignore_punctuation: bool, ignore_punctuation: bool,
} }
/// Selects a subword text object.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -61,6 +63,7 @@ struct Subword {
#[serde(default)] #[serde(default)]
ignore_punctuation: bool, ignore_punctuation: bool,
} }
/// Selects text at the same indentation level.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)] #[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)] #[action(namespace = vim)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -258,25 +261,45 @@ fn find_mini_brackets(
actions!( actions!(
vim, vim,
[ [
/// Selects a sentence text object.
Sentence, Sentence,
/// Selects a paragraph text object.
Paragraph, Paragraph,
/// Selects text within single quotes.
Quotes, Quotes,
/// Selects text within backticks.
BackQuotes, BackQuotes,
/// Selects text within the nearest quotes (single or double).
MiniQuotes, MiniQuotes,
/// Selects text within any type of quotes.
AnyQuotes, AnyQuotes,
/// Selects text within double quotes.
DoubleQuotes, DoubleQuotes,
/// Selects text within vertical bars (pipes).
VerticalBars, VerticalBars,
/// Selects text within parentheses.
Parentheses, Parentheses,
/// Selects text within the nearest brackets.
MiniBrackets, MiniBrackets,
/// Selects text within any type of brackets.
AnyBrackets, AnyBrackets,
/// Selects text within square brackets.
SquareBrackets, SquareBrackets,
/// Selects text within curly brackets.
CurlyBrackets, CurlyBrackets,
/// Selects text within angle brackets.
AngleBrackets, AngleBrackets,
/// Selects a function argument.
Argument, Argument,
/// Selects an HTML/XML tag.
Tag, Tag,
/// Selects a method or function.
Method, Method,
/// Selects a class definition.
Class, Class,
/// Selects a comment block.
Comment, Comment,
/// Selects the entire file.
EntireFile EntireFile
] ]
); );

View file

@ -13,7 +13,15 @@ use language::{Point, SelectionGoal};
use std::ops::Range; use std::ops::Range;
use std::sync::Arc; 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>) { pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
Vim::action(editor, cx, |vim, _: &ToggleReplace, window, cx| { Vim::action(editor, cx, |vim, _: &ToggleReplace, window, cx| {

View file

@ -4,7 +4,13 @@ use editor::{Bias, Editor, RewrapOptions, SelectionEffects, display_map::ToDispl
use gpui::{Context, Window, actions}; use gpui::{Context, Window, actions};
use language::SelectionGoal; 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>) { pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
Vim::action(editor, cx, |vim, _: &Rewrap, window, cx| { Vim::action(editor, cx, |vim, _: &Rewrap, window, cx| {

View file

@ -134,55 +134,105 @@ struct PushLiteral {
actions!( actions!(
vim, vim,
[ [
/// Switches to normal mode.
SwitchToNormalMode, SwitchToNormalMode,
/// Switches to insert mode.
SwitchToInsertMode, SwitchToInsertMode,
/// Switches to replace mode.
SwitchToReplaceMode, SwitchToReplaceMode,
/// Switches to visual mode.
SwitchToVisualMode, SwitchToVisualMode,
/// Switches to visual line mode.
SwitchToVisualLineMode, SwitchToVisualLineMode,
/// Switches to visual block mode.
SwitchToVisualBlockMode, SwitchToVisualBlockMode,
/// Switches to Helix-style normal mode.
SwitchToHelixNormalMode, SwitchToHelixNormalMode,
/// Clears any pending operators.
ClearOperators, ClearOperators,
/// Clears the exchange register.
ClearExchange, ClearExchange,
/// Inserts a tab character.
Tab, Tab,
/// Inserts a newline.
Enter, Enter,
/// Selects inner text object.
InnerObject, InnerObject,
/// Maximizes the current pane.
MaximizePane, MaximizePane,
/// Opens the default keymap file.
OpenDefaultKeymap, OpenDefaultKeymap,
/// Resets all pane sizes to default.
ResetPaneSizes, ResetPaneSizes,
/// Resizes the pane to the right.
ResizePaneRight, ResizePaneRight,
/// Resizes the pane to the left.
ResizePaneLeft, ResizePaneLeft,
/// Resizes the pane upward.
ResizePaneUp, ResizePaneUp,
/// Resizes the pane downward.
ResizePaneDown, ResizePaneDown,
/// Starts a change operation.
PushChange, PushChange,
/// Starts a delete operation.
PushDelete, PushDelete,
/// Exchanges text regions.
Exchange, Exchange,
/// Starts a yank operation.
PushYank, PushYank,
/// Starts a replace operation.
PushReplace, PushReplace,
/// Deletes surrounding characters.
PushDeleteSurrounds, PushDeleteSurrounds,
/// Sets a mark at the current position.
PushMark, PushMark,
/// Toggles the marks view.
ToggleMarksView, ToggleMarksView,
/// Starts a forced motion.
PushForcedMotion, PushForcedMotion,
/// Starts an indent operation.
PushIndent, PushIndent,
/// Starts an outdent operation.
PushOutdent, PushOutdent,
/// Starts an auto-indent operation.
PushAutoIndent, PushAutoIndent,
/// Starts a rewrap operation.
PushRewrap, PushRewrap,
/// Starts a shell command operation.
PushShellCommand, PushShellCommand,
/// Converts to lowercase.
PushLowercase, PushLowercase,
/// Converts to uppercase.
PushUppercase, PushUppercase,
/// Toggles case.
PushOppositeCase, PushOppositeCase,
/// Applies ROT13 encoding.
PushRot13, PushRot13,
/// Applies ROT47 encoding.
PushRot47, PushRot47,
/// Toggles the registers view.
ToggleRegistersView, ToggleRegistersView,
/// Selects a register.
PushRegister, PushRegister,
/// Starts recording to a register.
PushRecordRegister, PushRecordRegister,
/// Replays a register.
PushReplayRegister, PushReplayRegister,
/// Replaces with register contents.
PushReplaceWithRegister, PushReplaceWithRegister,
/// Toggles comments.
PushToggleComments, PushToggleComments,
] ]
); );
// in the workspace namespace so it's not filtered out when vim is disabled. // 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. /// Initializes the `vim` crate.
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {

View file

@ -23,23 +23,41 @@ use crate::{
actions!( actions!(
vim, vim,
[ [
/// Toggles visual mode.
ToggleVisual, ToggleVisual,
/// Toggles visual line mode.
ToggleVisualLine, ToggleVisualLine,
/// Toggles visual block mode.
ToggleVisualBlock, ToggleVisualBlock,
/// Deletes the visual selection.
VisualDelete, VisualDelete,
/// Deletes entire lines in visual selection.
VisualDeleteLine, VisualDeleteLine,
/// Yanks (copies) the visual selection.
VisualYank, VisualYank,
/// Yanks entire lines in visual selection.
VisualYankLine, VisualYankLine,
/// Moves cursor to the other end of the selection.
OtherEnd, OtherEnd,
/// Moves cursor to the other end of the selection (row-aware).
OtherEndRowAware, OtherEndRowAware,
/// Selects the next occurrence of the current selection.
SelectNext, SelectNext,
/// Selects the previous occurrence of the current selection.
SelectPrevious, SelectPrevious,
/// Selects the next match of the current selection.
SelectNextMatch, SelectNextMatch,
/// Selects the previous match of the current selection.
SelectPreviousMatch, SelectPreviousMatch,
/// Selects the next smaller syntax node.
SelectSmallerSyntaxNode, SelectSmallerSyntaxNode,
/// Selects the next larger syntax node.
SelectLargerSyntaxNode, SelectLargerSyntaxNode,
/// Restores the previous visual selection.
RestoreVisualSelection, RestoreVisualSelection,
/// Inserts at the end of each line in visual selection.
VisualInsertEndOfLine, VisualInsertEndOfLine,
/// Inserts at the first non-whitespace character of each line.
VisualInsertFirstNonWhiteSpace, VisualInsertFirstNonWhiteSpace,
] ]
); );

View file

@ -12,7 +12,13 @@ use ui::{ListItem, ListItemSpacing, prelude::*};
use util::ResultExt; use util::ResultExt;
use workspace::{ModalView, Workspace, ui::HighlightedLabel}; use workspace::{ModalView, Workspace, ui::HighlightedLabel};
actions!(welcome, [ToggleBaseKeymapSelector]); actions!(
welcome,
[
/// Toggles the base keymap selector modal.
ToggleBaseKeymapSelector
]
);
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {
cx.observe_new(|workspace: &mut Workspace, _window, _cx| { cx.observe_new(|workspace: &mut Workspace, _window, _cx| {

View file

@ -25,7 +25,13 @@ mod base_keymap_setting;
mod multibuffer_hint; mod multibuffer_hint;
mod welcome_ui; 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 FIRST_OPEN: &str = "first_open";
pub const DOCS_URL: &str = "https://zed.dev/docs/"; pub const DOCS_URL: &str = "https://zed.dev/docs/";

View file

@ -95,10 +95,12 @@ pub enum SaveIntent {
Skip, Skip,
} }
/// Activates a specific item in the pane by its index.
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
#[action(namespace = pane)] #[action(namespace = pane)]
pub struct ActivateItem(pub usize); pub struct ActivateItem(pub usize);
/// Closes the currently active item in the pane.
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
#[action(namespace = pane)] #[action(namespace = pane)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -109,6 +111,7 @@ pub struct CloseActiveItem {
pub close_pinned: bool, pub close_pinned: bool,
} }
/// Closes all inactive items in the pane.
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
#[action(namespace = pane)] #[action(namespace = pane)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -119,6 +122,7 @@ pub struct CloseInactiveItems {
pub close_pinned: bool, pub close_pinned: bool,
} }
/// Closes all items in the pane.
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
#[action(namespace = pane)] #[action(namespace = pane)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -129,6 +133,7 @@ pub struct CloseAllItems {
pub close_pinned: bool, pub close_pinned: bool,
} }
/// Closes all items that have no unsaved changes.
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
#[action(namespace = pane)] #[action(namespace = pane)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -137,6 +142,7 @@ pub struct CloseCleanItems {
pub close_pinned: bool, pub close_pinned: bool,
} }
/// Closes all items to the right of the current item.
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
#[action(namespace = pane)] #[action(namespace = pane)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -145,6 +151,7 @@ pub struct CloseItemsToTheRight {
pub close_pinned: bool, pub close_pinned: bool,
} }
/// Closes all items to the left of the current item.
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
#[action(namespace = pane)] #[action(namespace = pane)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -153,6 +160,7 @@ pub struct CloseItemsToTheLeft {
pub close_pinned: bool, pub close_pinned: bool,
} }
/// Reveals the current item in the project panel.
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
#[action(namespace = pane)] #[action(namespace = pane)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -161,6 +169,7 @@ pub struct RevealInProjectPanel {
pub entry_id: Option<u64>, pub entry_id: Option<u64>,
} }
/// Opens the search interface with the specified configuration.
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
#[action(namespace = pane)] #[action(namespace = pane)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -176,25 +185,45 @@ pub struct DeploySearch {
actions!( actions!(
pane, pane,
[ [
/// Activates the previous item in the pane.
ActivatePreviousItem, ActivatePreviousItem,
/// Activates the next item in the pane.
ActivateNextItem, ActivateNextItem,
/// Activates the last item in the pane.
ActivateLastItem, ActivateLastItem,
/// Switches to the alternate file.
AlternateFile, AlternateFile,
/// Navigates back in history.
GoBack, GoBack,
/// Navigates forward in history.
GoForward, GoForward,
/// Joins this pane into the next pane.
JoinIntoNext, JoinIntoNext,
/// Joins all panes into one.
JoinAll, JoinAll,
/// Reopens the most recently closed item.
ReopenClosedItem, ReopenClosedItem,
/// Splits the pane to the left.
SplitLeft, SplitLeft,
/// Splits the pane upward.
SplitUp, SplitUp,
/// Splits the pane to the right.
SplitRight, SplitRight,
/// Splits the pane downward.
SplitDown, SplitDown,
/// Splits the pane horizontally.
SplitHorizontal, SplitHorizontal,
/// Splits the pane vertically.
SplitVertical, SplitVertical,
/// Swaps the current item with the one to the left.
SwapItemLeft, SwapItemLeft,
/// Swaps the current item with the one to the right.
SwapItemRight, SwapItemRight,
/// Toggles preview mode for the current tab.
TogglePreviewTab, TogglePreviewTab,
/// Toggles pin status for the current tab.
TogglePinTab, TogglePinTab,
/// Unpins all tabs in the pane.
UnpinAllTabs, UnpinAllTabs,
] ]
); );

View file

@ -11,7 +11,13 @@ use ui::{
use crate::{Item, Workspace}; use crate::{Item, Workspace};
actions!(dev, [OpenThemePreview]); actions!(
dev,
[
/// Opens the theme preview window.
OpenThemePreview
]
);
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {
cx.observe_new(|workspace: &mut Workspace, _, _| { cx.observe_new(|workspace: &mut Workspace, _, _| {

View file

@ -169,44 +169,83 @@ pub trait DebuggerProvider {
actions!( actions!(
workspace, workspace,
[ [
/// Activates the next pane in the workspace.
ActivateNextPane, ActivateNextPane,
/// Activates the previous pane in the workspace.
ActivatePreviousPane, ActivatePreviousPane,
/// Switches to the next window.
ActivateNextWindow, ActivateNextWindow,
/// Switches to the previous window.
ActivatePreviousWindow, ActivatePreviousWindow,
/// Adds a folder to the current project.
AddFolderToProject, AddFolderToProject,
/// Clears all notifications.
ClearAllNotifications, ClearAllNotifications,
/// Closes the active dock.
CloseActiveDock, CloseActiveDock,
/// Closes all docks.
CloseAllDocks, CloseAllDocks,
/// Closes the current window.
CloseWindow, CloseWindow,
/// Opens the feedback dialog.
Feedback, Feedback,
/// Follows the next collaborator in the session.
FollowNextCollaborator, FollowNextCollaborator,
/// Moves the focused panel to the next position.
MoveFocusedPanelToNextPosition, MoveFocusedPanelToNextPosition,
/// Opens a new terminal in the center.
NewCenterTerminal, NewCenterTerminal,
/// Creates a new file.
NewFile, NewFile,
/// Creates a new file in a vertical split.
NewFileSplitVertical, NewFileSplitVertical,
/// Creates a new file in a horizontal split.
NewFileSplitHorizontal, NewFileSplitHorizontal,
/// Opens a new search.
NewSearch, NewSearch,
/// Opens a new terminal.
NewTerminal, NewTerminal,
/// Opens a new window.
NewWindow, NewWindow,
/// Opens a file or directory.
Open, Open,
/// Opens multiple files.
OpenFiles, OpenFiles,
/// Opens the current location in terminal.
OpenInTerminal, OpenInTerminal,
/// Opens the component preview.
OpenComponentPreview, OpenComponentPreview,
/// Reloads the active item.
ReloadActiveItem, ReloadActiveItem,
/// Resets the active dock to its default size.
ResetActiveDockSize, ResetActiveDockSize,
/// Resets all open docks to their default sizes.
ResetOpenDocksSize, ResetOpenDocksSize,
/// Saves the current file with a new name.
SaveAs, SaveAs,
/// Saves without formatting.
SaveWithoutFormat, SaveWithoutFormat,
/// Shuts down all debug adapters.
ShutdownDebugAdapters, ShutdownDebugAdapters,
/// Suppresses the current notification.
SuppressNotification, SuppressNotification,
/// Toggles the bottom dock.
ToggleBottomDock, ToggleBottomDock,
/// Toggles centered layout mode.
ToggleCenteredLayout, ToggleCenteredLayout,
/// Toggles the left dock.
ToggleLeftDock, ToggleLeftDock,
/// Toggles the right dock.
ToggleRightDock, ToggleRightDock,
/// Toggles zoom on the active pane.
ToggleZoom, ToggleZoom,
/// Stops following a collaborator.
Unfollow, Unfollow,
/// Shows the welcome screen.
Welcome, Welcome,
/// Restores the banner.
RestoreBanner, RestoreBanner,
/// Toggles expansion of the selected item.
ToggleExpandItem, ToggleExpandItem,
] ]
); );
@ -216,10 +255,12 @@ pub struct OpenPaths {
pub paths: Vec<PathBuf>, pub paths: Vec<PathBuf>,
} }
/// Activates a specific pane by its index.
#[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)] #[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)]
#[action(namespace = workspace)] #[action(namespace = workspace)]
pub struct ActivatePane(pub usize); pub struct ActivatePane(pub usize);
/// Moves an item to a specific pane by index.
#[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)] #[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)]
#[action(namespace = workspace)] #[action(namespace = workspace)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -236,6 +277,7 @@ fn default_1() -> usize {
1 1
} }
/// Moves an item to a pane in the specified direction.
#[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)] #[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)]
#[action(namespace = workspace)] #[action(namespace = workspace)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -252,6 +294,7 @@ fn default_right() -> SplitDirection {
SplitDirection::Right SplitDirection::Right
} }
/// Saves all open files in the workspace.
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Action)] #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = workspace)] #[action(namespace = workspace)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -260,6 +303,7 @@ pub struct SaveAll {
pub save_intent: Option<SaveIntent>, pub save_intent: Option<SaveIntent>,
} }
/// Saves the current file with the specified options.
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Action)] #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = workspace)] #[action(namespace = workspace)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -268,6 +312,7 @@ pub struct Save {
pub save_intent: Option<SaveIntent>, pub save_intent: Option<SaveIntent>,
} }
/// Closes all items and panes in the workspace.
#[derive(Clone, PartialEq, Debug, Deserialize, Default, JsonSchema, Action)] #[derive(Clone, PartialEq, Debug, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = workspace)] #[action(namespace = workspace)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -276,6 +321,7 @@ pub struct CloseAllItemsAndPanes {
pub save_intent: Option<SaveIntent>, pub save_intent: Option<SaveIntent>,
} }
/// Closes all inactive tabs and panes in the workspace.
#[derive(Clone, PartialEq, Debug, Deserialize, Default, JsonSchema, Action)] #[derive(Clone, PartialEq, Debug, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = workspace)] #[action(namespace = workspace)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -284,10 +330,12 @@ pub struct CloseInactiveTabsAndPanes {
pub save_intent: Option<SaveIntent>, pub save_intent: Option<SaveIntent>,
} }
/// Sends a sequence of keystrokes to the active element.
#[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)] #[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)]
#[action(namespace = workspace)] #[action(namespace = workspace)]
pub struct SendKeystrokes(pub String); pub struct SendKeystrokes(pub String);
/// Reloads the active item or workspace.
#[derive(Clone, Deserialize, PartialEq, Default, JsonSchema, Action)] #[derive(Clone, Deserialize, PartialEq, Default, JsonSchema, Action)]
#[action(namespace = workspace)] #[action(namespace = workspace)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -298,11 +346,13 @@ pub struct Reload {
actions!( actions!(
project_symbols, project_symbols,
[ [
/// Toggles the project symbols search.
#[action(name = "Toggle")] #[action(name = "Toggle")]
ToggleProjectSymbols ToggleProjectSymbols
] ]
); );
/// Toggles the file finder interface.
#[derive(Default, PartialEq, Eq, Clone, Deserialize, JsonSchema, Action)] #[derive(Default, PartialEq, Eq, Clone, Deserialize, JsonSchema, Action)]
#[action(namespace = file_finder, name = "Toggle")] #[action(namespace = file_finder, name = "Toggle")]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -354,13 +404,21 @@ pub struct DecreaseOpenDocksSize {
actions!( actions!(
workspace, workspace,
[ [
/// Activates the pane to the left.
ActivatePaneLeft, ActivatePaneLeft,
/// Activates the pane to the right.
ActivatePaneRight, ActivatePaneRight,
/// Activates the pane above.
ActivatePaneUp, ActivatePaneUp,
/// Activates the pane below.
ActivatePaneDown, ActivatePaneDown,
/// Swaps the current pane with the one to the left.
SwapPaneLeft, SwapPaneLeft,
/// Swaps the current pane with the one to the right.
SwapPaneRight, SwapPaneRight,
/// Swaps the current pane with the one above.
SwapPaneUp, SwapPaneUp,
/// Swaps the current pane with the one below.
SwapPaneDown, 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)] #[derive(Debug, Default, Clone, Deserialize, PartialEq, JsonSchema, Action)]
#[action(namespace = workspace)] #[action(namespace = workspace)]
#[serde(deny_unknown_fields)] #[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 /// 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`. /// buffer. These URLs look like `https://zed.dev/channel/channel-name-CHANNEL_ID/notes`.
OpenChannelNotes, OpenChannelNotes,
/// Mutes your microphone.
Mute, Mute,
/// Deafens yourself (mute both microphone and speakers).
Deafen, Deafen,
/// Leaves the current call.
LeaveCall, LeaveCall,
/// Shares the current project with collaborators.
ShareProject, ShareProject,
/// Shares your screen with collaborators.
ScreenShare ScreenShare
] ]
); );
actions!(zed, [OpenLog]); actions!(
zed,
[
/// Opens the Zed log file.
OpenLog
]
);
async fn join_channel_internal( async fn join_channel_internal(
channel_id: ChannelId, channel_id: ChannelId,

View file

@ -1368,6 +1368,7 @@ fn dump_all_gpui_actions() {
name: &'static str, name: &'static str,
human_name: String, human_name: String,
aliases: &'static [&'static str], aliases: &'static [&'static str],
documentation: Option<&'static str>,
} }
let mut actions = gpui::generate_list_of_all_registered_actions() let mut actions = gpui::generate_list_of_all_registered_actions()
.into_iter() .into_iter()
@ -1375,6 +1376,7 @@ fn dump_all_gpui_actions() {
name: action.name, name: action.name,
human_name: command_palette::humanize_action_name(action.name), human_name: command_palette::humanize_action_name(action.name),
aliases: action.deprecated_aliases, aliases: action.deprecated_aliases,
documentation: action.documentation,
}) })
.collect::<Vec<ActionDef>>(); .collect::<Vec<ActionDef>>();

View file

@ -78,19 +78,33 @@ use zed_actions::{
actions!( actions!(
zed, zed,
[ [
/// Opens the element inspector for debugging UI.
DebugElements, DebugElements,
/// Hides the application window.
Hide, Hide,
/// Hides all other application windows.
HideOthers, HideOthers,
/// Minimizes the current window.
Minimize, Minimize,
/// Opens the default settings file.
OpenDefaultSettings, OpenDefaultSettings,
/// Opens project-specific settings.
OpenProjectSettings, OpenProjectSettings,
/// Opens the project tasks configuration.
OpenProjectTasks, OpenProjectTasks,
/// Opens the tasks panel.
OpenTasks, OpenTasks,
/// Opens debug tasks configuration.
OpenDebugTasks, OpenDebugTasks,
/// Resets the application database.
ResetDatabase, ResetDatabase,
/// Shows all hidden windows.
ShowAll, ShowAll,
/// Toggles fullscreen mode.
ToggleFullScreen, ToggleFullScreen,
/// Zooms the window.
Zoom, Zoom,
/// Triggers a test panic for debugging.
TestPanic, TestPanic,
] ]
); );

View file

@ -11,6 +11,7 @@ use serde::{Deserialize, Serialize};
// https://github.com/mmastrac/rust-ctor/issues/280 // https://github.com/mmastrac/rust-ctor/issues/280
pub fn init() {} pub fn init() {}
/// Opens a URL in the system's default web browser.
#[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)] #[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -18,6 +19,7 @@ pub struct OpenBrowser {
pub url: String, pub url: String,
} }
/// Opens a zed:// URL within the application.
#[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)] #[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -28,15 +30,25 @@ pub struct OpenZedUrl {
actions!( actions!(
zed, zed,
[ [
/// Opens the settings editor.
OpenSettings, OpenSettings,
/// Opens the default keymap file.
OpenDefaultKeymap, OpenDefaultKeymap,
/// Opens account settings.
OpenAccountSettings, OpenAccountSettings,
/// Opens server settings.
OpenServerSettings, OpenServerSettings,
/// Quits the application.
Quit, Quit,
/// Opens the user keymap file.
OpenKeymap, OpenKeymap,
/// Shows information about Zed.
About, About,
/// Opens the documentation website.
OpenDocs, OpenDocs,
/// Views open source licenses.
OpenLicenses, OpenLicenses,
/// Opens the telemetry log.
OpenTelemetryLog, OpenTelemetryLog,
] ]
); );
@ -56,6 +68,7 @@ pub enum ExtensionCategoryFilter {
DebugAdapters, DebugAdapters,
} }
/// Opens the extensions management interface.
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -65,6 +78,7 @@ pub struct Extensions {
pub category_filter: Option<ExtensionCategoryFilter>, pub category_filter: Option<ExtensionCategoryFilter>,
} }
/// Decreases the font size in the editor buffer.
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -73,6 +87,7 @@ pub struct DecreaseBufferFontSize {
pub persist: bool, pub persist: bool,
} }
/// Increases the font size in the editor buffer.
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -81,6 +96,7 @@ pub struct IncreaseBufferFontSize {
pub persist: bool, pub persist: bool,
} }
/// Resets the buffer font size to the default value.
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -89,6 +105,7 @@ pub struct ResetBufferFontSize {
pub persist: bool, pub persist: bool,
} }
/// Decreases the font size of the user interface.
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -97,6 +114,7 @@ pub struct DecreaseUiFontSize {
pub persist: bool, pub persist: bool,
} }
/// Increases the font size of the user interface.
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -105,6 +123,7 @@ pub struct IncreaseUiFontSize {
pub persist: bool, pub persist: bool,
} }
/// Resets the UI font size to the default value.
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)] #[action(namespace = zed)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -116,7 +135,13 @@ pub struct ResetUiFontSize {
pub mod dev { pub mod dev {
use gpui::actions; use gpui::actions;
actions!(dev, [ToggleInspector]); actions!(
dev,
[
/// Toggles the developer inspector for debugging UI elements.
ToggleInspector
]
);
} }
pub mod workspace { pub mod workspace {
@ -139,9 +164,13 @@ pub mod git {
actions!( actions!(
git, git,
[ [
/// Checks out a different git branch.
CheckoutBranch, CheckoutBranch,
/// Switches to a different git branch.
Switch, Switch,
/// Selects a different repository.
SelectRepo, SelectRepo,
/// Opens the git branch selector.
#[action(deprecated_aliases = ["branches::OpenRecent"])] #[action(deprecated_aliases = ["branches::OpenRecent"])]
Branch Branch
] ]
@ -151,25 +180,51 @@ pub mod git {
pub mod jj { pub mod jj {
use gpui::actions; use gpui::actions;
actions!(jj, [BookmarkList]); actions!(
jj,
[
/// Opens the Jujutsu bookmark list.
BookmarkList
]
);
} }
pub mod toast { pub mod toast {
use gpui::actions; use gpui::actions;
actions!(toast, [RunAction]); actions!(
toast,
[
/// Runs the action associated with a toast notification.
RunAction
]
);
} }
pub mod command_palette { pub mod command_palette {
use gpui::actions; use gpui::actions;
actions!(command_palette, [Toggle]); actions!(
command_palette,
[
/// Toggles the command palette.
Toggle
]
);
} }
pub mod feedback { pub mod feedback {
use gpui::actions; use gpui::actions;
actions!(feedback, [FileBugReport, GiveFeedback]); actions!(
feedback,
[
/// Opens the bug report form.
FileBugReport,
/// Opens the feedback form.
GiveFeedback
]
);
} }
pub mod theme_selector { pub mod theme_selector {
@ -177,6 +232,7 @@ pub mod theme_selector {
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::Deserialize; use serde::Deserialize;
/// Toggles the theme selector interface.
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = theme_selector)] #[action(namespace = theme_selector)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -191,6 +247,7 @@ pub mod icon_theme_selector {
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::Deserialize; use serde::Deserialize;
/// Toggles the icon theme selector interface.
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = icon_theme_selector)] #[action(namespace = icon_theme_selector)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -205,7 +262,14 @@ pub mod agent {
actions!( actions!(
agent, 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)] #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = agent, deprecated_aliases = ["assistant::OpenRulesLibrary", "assistant::DeployPromptLibrary"])] #[action(namespace = agent, deprecated_aliases = ["assistant::OpenRulesLibrary", "assistant::DeployPromptLibrary"])]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -233,6 +304,7 @@ pub mod assistant {
pub prompt_to_select: Option<Uuid>, pub prompt_to_select: Option<Uuid>,
} }
/// Deploys the assistant interface with the specified configuration.
#[derive(Clone, Default, Deserialize, PartialEq, JsonSchema, Action)] #[derive(Clone, Default, Deserialize, PartialEq, JsonSchema, Action)]
#[action(namespace = assistant)] #[action(namespace = assistant)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -244,9 +316,18 @@ pub mod assistant {
pub mod debugger { pub mod debugger {
use gpui::actions; 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)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = projects)] #[action(namespace = projects)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -255,6 +336,7 @@ pub struct OpenRecent {
pub create_new_window: bool, pub create_new_window: bool,
} }
/// Creates a project from a selected template.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = projects)] #[action(namespace = projects)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -276,7 +358,7 @@ pub enum RevealTarget {
Dock, 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)] #[derive(Debug, PartialEq, Clone, Deserialize, JsonSchema, Action)]
#[action(namespace = task)] #[action(namespace = task)]
#[serde(untagged)] #[serde(untagged)]
@ -309,7 +391,7 @@ impl Spawn {
} }
} }
/// Rerun the last task. /// Reruns the last task.
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
#[action(namespace = task)] #[action(namespace = task)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
@ -350,15 +432,36 @@ pub mod outline {
pub static TOGGLE_OUTLINE: OnceLock<fn(AnyView, &mut Window, &mut App)> = OnceLock::new(); pub static TOGGLE_OUTLINE: OnceLock<fn(AnyView, &mut Window, &mut App)> = OnceLock::new();
} }
actions!(zed_predict_onboarding, [OpenZedPredictOnboarding]); actions!(
actions!(git_onboarding, [OpenGitIntegrationOnboarding]); 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!( actions!(
debugger, debugger,
[ [
/// Toggles the enabled state of a breakpoint.
ToggleEnableBreakpoint, ToggleEnableBreakpoint,
/// Removes a breakpoint.
UnsetBreakpoint, UnsetBreakpoint,
/// Opens the project debug tasks configuration.
OpenProjectDebugTasks, OpenProjectDebugTasks,
] ]
); );

View file

@ -10,7 +10,15 @@ use workspace::Workspace;
use crate::{RateCompletionModal, onboarding_modal::ZedPredictModal}; 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) { pub fn init(cx: &mut App) {
cx.observe_new(move |workspace: &mut Workspace, _, _cx| { cx.observe_new(move |workspace: &mut Workspace, _, _cx| {

View file

@ -9,11 +9,17 @@ use workspace::{ModalView, Workspace};
actions!( actions!(
zeta, zeta,
[ [
/// Rates the active completion with a thumbs up.
ThumbsUpActiveCompletion, ThumbsUpActiveCompletion,
/// Rates the active completion with a thumbs down.
ThumbsDownActiveCompletion, ThumbsDownActiveCompletion,
/// Navigates to the next edit in the completion history.
NextEdit, NextEdit,
/// Navigates to the previous edit in the completion history.
PreviousEdit, PreviousEdit,
/// Focuses on the completions list.
FocusCompletions, FocusCompletions,
/// Previews the selected completion.
PreviewCompletion, PreviewCompletion,
] ]
); );

View file

@ -72,7 +72,13 @@ const MAX_EVENT_TOKENS: usize = 500;
/// Maximum number of events to track. /// Maximum number of events to track.
const MAX_EVENT_COUNT: usize = 16; 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)] #[derive(Copy, Clone, Default, Debug, PartialEq, Eq, Hash)]
pub struct InlineCompletionId(Uuid); pub struct InlineCompletionId(Uuid);