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