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:
parent
def8bab5a8
commit
6cd4dbdea1
96 changed files with 1467 additions and 78 deletions
|
@ -95,10 +95,12 @@ pub enum SaveIntent {
|
|||
Skip,
|
||||
}
|
||||
|
||||
/// Activates a specific item in the pane by its index.
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
|
||||
#[action(namespace = pane)]
|
||||
pub struct ActivateItem(pub usize);
|
||||
|
||||
/// Closes the currently active item in the pane.
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
|
||||
#[action(namespace = pane)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
|
@ -109,6 +111,7 @@ pub struct CloseActiveItem {
|
|||
pub close_pinned: bool,
|
||||
}
|
||||
|
||||
/// Closes all inactive items in the pane.
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
|
||||
#[action(namespace = pane)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
|
@ -119,6 +122,7 @@ pub struct CloseInactiveItems {
|
|||
pub close_pinned: bool,
|
||||
}
|
||||
|
||||
/// Closes all items in the pane.
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
|
||||
#[action(namespace = pane)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
|
@ -129,6 +133,7 @@ pub struct CloseAllItems {
|
|||
pub close_pinned: bool,
|
||||
}
|
||||
|
||||
/// Closes all items that have no unsaved changes.
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
|
||||
#[action(namespace = pane)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
|
@ -137,6 +142,7 @@ pub struct CloseCleanItems {
|
|||
pub close_pinned: bool,
|
||||
}
|
||||
|
||||
/// Closes all items to the right of the current item.
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
|
||||
#[action(namespace = pane)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
|
@ -145,6 +151,7 @@ pub struct CloseItemsToTheRight {
|
|||
pub close_pinned: bool,
|
||||
}
|
||||
|
||||
/// Closes all items to the left of the current item.
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
|
||||
#[action(namespace = pane)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
|
@ -153,6 +160,7 @@ pub struct CloseItemsToTheLeft {
|
|||
pub close_pinned: bool,
|
||||
}
|
||||
|
||||
/// Reveals the current item in the project panel.
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
|
||||
#[action(namespace = pane)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
|
@ -161,6 +169,7 @@ pub struct RevealInProjectPanel {
|
|||
pub entry_id: Option<u64>,
|
||||
}
|
||||
|
||||
/// Opens the search interface with the specified configuration.
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
|
||||
#[action(namespace = pane)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
|
@ -176,25 +185,45 @@ pub struct DeploySearch {
|
|||
actions!(
|
||||
pane,
|
||||
[
|
||||
/// Activates the previous item in the pane.
|
||||
ActivatePreviousItem,
|
||||
/// Activates the next item in the pane.
|
||||
ActivateNextItem,
|
||||
/// Activates the last item in the pane.
|
||||
ActivateLastItem,
|
||||
/// Switches to the alternate file.
|
||||
AlternateFile,
|
||||
/// Navigates back in history.
|
||||
GoBack,
|
||||
/// Navigates forward in history.
|
||||
GoForward,
|
||||
/// Joins this pane into the next pane.
|
||||
JoinIntoNext,
|
||||
/// Joins all panes into one.
|
||||
JoinAll,
|
||||
/// Reopens the most recently closed item.
|
||||
ReopenClosedItem,
|
||||
/// Splits the pane to the left.
|
||||
SplitLeft,
|
||||
/// Splits the pane upward.
|
||||
SplitUp,
|
||||
/// Splits the pane to the right.
|
||||
SplitRight,
|
||||
/// Splits the pane downward.
|
||||
SplitDown,
|
||||
/// Splits the pane horizontally.
|
||||
SplitHorizontal,
|
||||
/// Splits the pane vertically.
|
||||
SplitVertical,
|
||||
/// Swaps the current item with the one to the left.
|
||||
SwapItemLeft,
|
||||
/// Swaps the current item with the one to the right.
|
||||
SwapItemRight,
|
||||
/// Toggles preview mode for the current tab.
|
||||
TogglePreviewTab,
|
||||
/// Toggles pin status for the current tab.
|
||||
TogglePinTab,
|
||||
/// Unpins all tabs in the pane.
|
||||
UnpinAllTabs,
|
||||
]
|
||||
);
|
||||
|
|
|
@ -11,7 +11,13 @@ use ui::{
|
|||
|
||||
use crate::{Item, Workspace};
|
||||
|
||||
actions!(dev, [OpenThemePreview]);
|
||||
actions!(
|
||||
dev,
|
||||
[
|
||||
/// Opens the theme preview window.
|
||||
OpenThemePreview
|
||||
]
|
||||
);
|
||||
|
||||
pub fn init(cx: &mut App) {
|
||||
cx.observe_new(|workspace: &mut Workspace, _, _| {
|
||||
|
|
|
@ -169,44 +169,83 @@ pub trait DebuggerProvider {
|
|||
actions!(
|
||||
workspace,
|
||||
[
|
||||
/// Activates the next pane in the workspace.
|
||||
ActivateNextPane,
|
||||
/// Activates the previous pane in the workspace.
|
||||
ActivatePreviousPane,
|
||||
/// Switches to the next window.
|
||||
ActivateNextWindow,
|
||||
/// Switches to the previous window.
|
||||
ActivatePreviousWindow,
|
||||
/// Adds a folder to the current project.
|
||||
AddFolderToProject,
|
||||
/// Clears all notifications.
|
||||
ClearAllNotifications,
|
||||
/// Closes the active dock.
|
||||
CloseActiveDock,
|
||||
/// Closes all docks.
|
||||
CloseAllDocks,
|
||||
/// Closes the current window.
|
||||
CloseWindow,
|
||||
/// Opens the feedback dialog.
|
||||
Feedback,
|
||||
/// Follows the next collaborator in the session.
|
||||
FollowNextCollaborator,
|
||||
/// Moves the focused panel to the next position.
|
||||
MoveFocusedPanelToNextPosition,
|
||||
/// Opens a new terminal in the center.
|
||||
NewCenterTerminal,
|
||||
/// Creates a new file.
|
||||
NewFile,
|
||||
/// Creates a new file in a vertical split.
|
||||
NewFileSplitVertical,
|
||||
/// Creates a new file in a horizontal split.
|
||||
NewFileSplitHorizontal,
|
||||
/// Opens a new search.
|
||||
NewSearch,
|
||||
/// Opens a new terminal.
|
||||
NewTerminal,
|
||||
/// Opens a new window.
|
||||
NewWindow,
|
||||
/// Opens a file or directory.
|
||||
Open,
|
||||
/// Opens multiple files.
|
||||
OpenFiles,
|
||||
/// Opens the current location in terminal.
|
||||
OpenInTerminal,
|
||||
/// Opens the component preview.
|
||||
OpenComponentPreview,
|
||||
/// Reloads the active item.
|
||||
ReloadActiveItem,
|
||||
/// Resets the active dock to its default size.
|
||||
ResetActiveDockSize,
|
||||
/// Resets all open docks to their default sizes.
|
||||
ResetOpenDocksSize,
|
||||
/// Saves the current file with a new name.
|
||||
SaveAs,
|
||||
/// Saves without formatting.
|
||||
SaveWithoutFormat,
|
||||
/// Shuts down all debug adapters.
|
||||
ShutdownDebugAdapters,
|
||||
/// Suppresses the current notification.
|
||||
SuppressNotification,
|
||||
/// Toggles the bottom dock.
|
||||
ToggleBottomDock,
|
||||
/// Toggles centered layout mode.
|
||||
ToggleCenteredLayout,
|
||||
/// Toggles the left dock.
|
||||
ToggleLeftDock,
|
||||
/// Toggles the right dock.
|
||||
ToggleRightDock,
|
||||
/// Toggles zoom on the active pane.
|
||||
ToggleZoom,
|
||||
/// Stops following a collaborator.
|
||||
Unfollow,
|
||||
/// Shows the welcome screen.
|
||||
Welcome,
|
||||
/// Restores the banner.
|
||||
RestoreBanner,
|
||||
/// Toggles expansion of the selected item.
|
||||
ToggleExpandItem,
|
||||
]
|
||||
);
|
||||
|
@ -216,10 +255,12 @@ pub struct OpenPaths {
|
|||
pub paths: Vec<PathBuf>,
|
||||
}
|
||||
|
||||
/// Activates a specific pane by its index.
|
||||
#[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)]
|
||||
#[action(namespace = workspace)]
|
||||
pub struct ActivatePane(pub usize);
|
||||
|
||||
/// Moves an item to a specific pane by index.
|
||||
#[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)]
|
||||
#[action(namespace = workspace)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
|
@ -236,6 +277,7 @@ fn default_1() -> usize {
|
|||
1
|
||||
}
|
||||
|
||||
/// Moves an item to a pane in the specified direction.
|
||||
#[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)]
|
||||
#[action(namespace = workspace)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
|
@ -252,6 +294,7 @@ fn default_right() -> SplitDirection {
|
|||
SplitDirection::Right
|
||||
}
|
||||
|
||||
/// Saves all open files in the workspace.
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Action)]
|
||||
#[action(namespace = workspace)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
|
@ -260,6 +303,7 @@ pub struct SaveAll {
|
|||
pub save_intent: Option<SaveIntent>,
|
||||
}
|
||||
|
||||
/// Saves the current file with the specified options.
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Action)]
|
||||
#[action(namespace = workspace)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
|
@ -268,6 +312,7 @@ pub struct Save {
|
|||
pub save_intent: Option<SaveIntent>,
|
||||
}
|
||||
|
||||
/// Closes all items and panes in the workspace.
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, Default, JsonSchema, Action)]
|
||||
#[action(namespace = workspace)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
|
@ -276,6 +321,7 @@ pub struct CloseAllItemsAndPanes {
|
|||
pub save_intent: Option<SaveIntent>,
|
||||
}
|
||||
|
||||
/// Closes all inactive tabs and panes in the workspace.
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, Default, JsonSchema, Action)]
|
||||
#[action(namespace = workspace)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
|
@ -284,10 +330,12 @@ pub struct CloseInactiveTabsAndPanes {
|
|||
pub save_intent: Option<SaveIntent>,
|
||||
}
|
||||
|
||||
/// Sends a sequence of keystrokes to the active element.
|
||||
#[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)]
|
||||
#[action(namespace = workspace)]
|
||||
pub struct SendKeystrokes(pub String);
|
||||
|
||||
/// Reloads the active item or workspace.
|
||||
#[derive(Clone, Deserialize, PartialEq, Default, JsonSchema, Action)]
|
||||
#[action(namespace = workspace)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
|
@ -298,11 +346,13 @@ pub struct Reload {
|
|||
actions!(
|
||||
project_symbols,
|
||||
[
|
||||
/// Toggles the project symbols search.
|
||||
#[action(name = "Toggle")]
|
||||
ToggleProjectSymbols
|
||||
]
|
||||
);
|
||||
|
||||
/// Toggles the file finder interface.
|
||||
#[derive(Default, PartialEq, Eq, Clone, Deserialize, JsonSchema, Action)]
|
||||
#[action(namespace = file_finder, name = "Toggle")]
|
||||
#[serde(deny_unknown_fields)]
|
||||
|
@ -354,13 +404,21 @@ pub struct DecreaseOpenDocksSize {
|
|||
actions!(
|
||||
workspace,
|
||||
[
|
||||
/// Activates the pane to the left.
|
||||
ActivatePaneLeft,
|
||||
/// Activates the pane to the right.
|
||||
ActivatePaneRight,
|
||||
/// Activates the pane above.
|
||||
ActivatePaneUp,
|
||||
/// Activates the pane below.
|
||||
ActivatePaneDown,
|
||||
/// Swaps the current pane with the one to the left.
|
||||
SwapPaneLeft,
|
||||
/// Swaps the current pane with the one to the right.
|
||||
SwapPaneRight,
|
||||
/// Swaps the current pane with the one above.
|
||||
SwapPaneUp,
|
||||
/// Swaps the current pane with the one below.
|
||||
SwapPaneDown,
|
||||
]
|
||||
);
|
||||
|
@ -416,6 +474,7 @@ impl PartialEq for Toast {
|
|||
}
|
||||
}
|
||||
|
||||
/// Opens a new terminal with the specified working directory.
|
||||
#[derive(Debug, Default, Clone, Deserialize, PartialEq, JsonSchema, Action)]
|
||||
#[action(namespace = workspace)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
|
@ -6677,14 +6736,25 @@ actions!(
|
|||
/// can be copied via "Copy link to section" in the context menu of the channel notes
|
||||
/// buffer. These URLs look like `https://zed.dev/channel/channel-name-CHANNEL_ID/notes`.
|
||||
OpenChannelNotes,
|
||||
/// Mutes your microphone.
|
||||
Mute,
|
||||
/// Deafens yourself (mute both microphone and speakers).
|
||||
Deafen,
|
||||
/// Leaves the current call.
|
||||
LeaveCall,
|
||||
/// Shares the current project with collaborators.
|
||||
ShareProject,
|
||||
/// Shares your screen with collaborators.
|
||||
ScreenShare
|
||||
]
|
||||
);
|
||||
actions!(zed, [OpenLog]);
|
||||
actions!(
|
||||
zed,
|
||||
[
|
||||
/// Opens the Zed log file.
|
||||
OpenLog
|
||||
]
|
||||
);
|
||||
|
||||
async fn join_channel_internal(
|
||||
channel_id: ChannelId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue