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

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

View file

@ -33,7 +33,12 @@ use zed_actions::{ToggleEnableBreakpoint, UnsetBreakpoint};
actions!(
debugger,
[PreviousBreakpointProperty, NextBreakpointProperty]
[
/// Navigates to the previous breakpoint property in the list.
PreviousBreakpointProperty,
/// Navigates to the next breakpoint property in the list.
NextBreakpointProperty
]
);
#[derive(Clone, Copy, PartialEq)]
pub(crate) enum SelectedBreakpointKind {

View file

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

View file

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