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

@ -28,10 +28,26 @@ use crate::{
ui_components::table::{Table, TableInteractionState},
};
actions!(zed, [OpenKeymapEditor]);
actions!(
zed,
[
/// Opens the keymap editor.
OpenKeymapEditor
]
);
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) {
let keymap_event_channel = KeymapEventChannel::new();

View file

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