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

@ -150,6 +150,15 @@ pub trait Action: Any + Send {
{
None
}
/// The documentation for this action, if any. When using the derive macro for actions
/// this will be automatically generated from the doc comments on the action struct.
fn documentation() -> Option<&'static str>
where
Self: Sized,
{
None
}
}
impl std::fmt::Debug for dyn Action {
@ -254,6 +263,7 @@ pub struct MacroActionData {
pub json_schema: fn(&mut schemars::SchemaGenerator) -> Option<schemars::Schema>,
pub deprecated_aliases: &'static [&'static str],
pub deprecation_message: Option<&'static str>,
pub documentation: Option<&'static str>,
}
inventory::collect!(MacroActionBuilder);
@ -276,6 +286,7 @@ impl ActionRegistry {
json_schema: A::action_json_schema,
deprecated_aliases: A::deprecated_aliases(),
deprecation_message: A::deprecation_message(),
documentation: A::documentation(),
});
}