ZIm/crates/ui/src/components
Michael Sloan 24c94d474e
gpui: Simplify Action macros + support doc comments in actions! (#33263)
Instead of a menagerie of macros for implementing `Action`, now there
are just two:

* `actions!(editor, [MoveLeft, MoveRight])`
* `#[derive(..., Action)]` with `#[action(namespace = editor)]`

In both contexts, `///` doc comments can be provided and will be used in
`JsonSchema`.

In both contexts, parameters can provided in `#[action(...)]`:

- `namespace = some_namespace` sets the namespace. In Zed this is
required.

- `name = "ActionName"` overrides the action's name. This must not
contain "::".

- `no_json` causes the `build` method to always error and
`action_json_schema` to return `None`
and allows actions not implement `serde::Serialize` and
`schemars::JsonSchema`.

- `no_register` skips registering the action. This is useful for
implementing the `Action` trait
while not supporting invocation by name or JSON deserialization.

- `deprecated_aliases = ["editor::SomeAction"]` specifies deprecated old
names for the action.
These action names should *not* correspond to any actions that are
registered. These old names
can then still be used to refer to invoke this action. In Zed, the
keymap JSON schema will
accept these old names and provide warnings.

- `deprecated = "Message about why this action is deprecation"`
specifies a deprecation message.
In Zed, the keymap JSON schema will cause this to be displayed as a
warning. This is a new feature.

Also makes the following changes since this seems like a good time to
make breaking changes:

* In `zed.rs` tests adds a test with an explicit list of namespaces. The
rationale for this is that there is otherwise no checking of `namespace
= ...` attributes.

* `Action::debug_name` renamed to `name_for_type`, since its only
difference with `name` was that it

* `Action::name` now returns `&'static str` instead of `&str` to match
the return of `name_for_type`. This makes the action trait more limited,
but the code was already assuming that `name_for_type` is the same as
`name`, and it requires `&'static`. So really this just makes the trait
harder to misuse.

* Various action reflection methods now use `&'static str` instead of
`SharedString`.

Release Notes:

- N/A
2025-06-24 04:34:51 +00:00
..
button debugger: Add variable watchers (#32743) 2025-06-20 20:45:55 +00:00
icon ui: Remove usage of DerivePathStr macro (#30861) 2025-05-17 09:05:58 +00:00
label ui: Add inline_code method to label (#29306) 2025-04-23 19:27:56 -03:00
list agent: Show delete thread icon buttons on hover/focus (#30370) 2025-05-09 12:55:40 -03:00
notification component: Component crate cleanup (#29967) 2025-05-06 03:41:52 +00:00
progress Add initial element inspector for Zed development (#31315) 2025-05-23 23:08:59 +00:00
stories gpui: Simplify Action macros + support doc comments in actions! (#33263) 2025-06-24 04:34:51 +00:00
avatar.rs Refine component preview & add serialization (#28545) 2025-04-11 11:43:57 -04:00
banner.rs agent: Improve consecutive tool call UX and rebrand Max Mode (#31470) 2025-05-27 19:44:10 -03:00
button.rs debugger: First slight pass at UI (#27034) 2025-03-19 00:15:48 +00:00
callout.rs agent: Suggest turning burn mode on when close to the context window limit (#32691) 2025-06-13 11:41:17 -03:00
content_group.rs Merge Component and ComponentPreview trait (#28365) 2025-04-08 16:09:06 -06:00
context_menu.rs debugger: Add actions and keybindings for opening the thread and session menus (#31135) 2025-05-21 20:56:39 -04:00
disclosure.rs agent: Adjust MCP section in the settings view (#28615) 2025-04-11 21:39:57 -03:00
divider.rs Merge Component and ComponentPreview trait (#28365) 2025-04-08 16:09:06 -06:00
dropdown_menu.rs debugger: Add actions and keybindings for opening the thread and session menus (#31135) 2025-05-21 20:56:39 -04:00
facepile.rs Merge Component and ComponentPreview trait (#28365) 2025-04-08 16:09:06 -06:00
group.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
icon.rs Add progress bar component (#28518) 2025-04-10 12:11:58 -06:00
image.rs debugger: Add onboarding modal (#32961) 2025-06-18 18:44:02 +00:00
indent_guides.rs Improve cursor style behavior for some draggable elements (#31965) 2025-06-06 16:56:27 -04:00
indicator.rs Merge Component and ComponentPreview trait (#28365) 2025-04-08 16:09:06 -06:00
keybinding.rs Fix bindings_for_action handling of shadowed key bindings (#32220) 2025-06-06 06:24:59 +00:00
keybinding_hint.rs Add initial element inspector for Zed development (#31315) 2025-05-23 23:08:59 +00:00
label.rs chore: Revert changes made to ui crate structure (#17516) 2024-09-06 21:38:56 +02:00
list.rs chore: Revert changes made to ui crate structure (#17516) 2024-09-06 21:38:56 +02:00
modal.rs Reduce allocations (#30693) 2025-05-14 18:29:28 +02:00
navigable.rs agent: Refresh the profile selector and modal design (#29816) 2025-05-02 20:34:36 -03:00
notification.rs Add StatusToast & the ToastLayer (#26232) 2025-03-06 20:37:54 +00:00
numeric_stepper.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
popover.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
popover_menu.rs gpui: Support hitbox blocking mouse interaction except scrolling (#31712) 2025-05-29 21:41:15 +00:00
progress.rs Add progress bar component (#28518) 2025-04-10 12:11:58 -06:00
radio.rs ui: More component previews, UI component cleanup (#25302) 2025-02-21 09:20:53 -05:00
right_click_menu.rs gpui: Support hitbox blocking mouse interaction except scrolling (#31712) 2025-05-29 21:41:15 +00:00
scrollbar.rs Improve cursor style behavior for some draggable elements (#31965) 2025-06-06 16:56:27 -04:00
settings_container.rs Merge Component and ComponentPreview trait (#28365) 2025-04-08 16:09:06 -06:00
settings_group.rs Merge Component and ComponentPreview trait (#28365) 2025-04-08 16:09:06 -06:00
stack.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
stories.rs Merge Component and ComponentPreview trait (#28365) 2025-04-08 16:09:06 -06:00
tab.rs ui: Fix content shift when selecting last tab (#31266) 2025-05-24 23:36:51 +03:00
tab_bar.rs Merge Component and ComponentPreview trait (#28365) 2025-04-08 16:09:06 -06:00
table.rs Merge Component and ComponentPreview trait (#28365) 2025-04-08 16:09:06 -06:00
toggle.rs ui: Add .color method to the Switch (#29074) 2025-04-21 10:56:42 -03:00
tooltip.rs agent: Add websearch tool (#28621) 2025-04-16 19:25:00 +02:00