Files
openidea/wit/hover-actions.wit
T
QandNeverKnowsTomorrow ac08cd85b2 feat(plugins): API 1.14 hover actions (#4544)
Adds the optional hover-actions export (plugin API 1.14): plugins contribute a host-rendered action at the left edge of an editor line, revealed by hovering the first four columns of any line in its start-line..end-line range and anchored to its declaration line. The host keeps it left of the line's text, out of the intention bulb's row, never takes focus on hover, collapses several actions into an overflow menu, and lists them in the editor context menu for keyboard access. SDK HoverActions, a minimal fixture, API-compat tests, docs and regenerated components.

Review fixes: the button is positioned on its first show (it was left unpositioned until the next mouse move), the styles use theme tokens, the overflow menu is the shared context menu, and the labels go through the text catalog.

Co-authored-by: NeverKnowsTomorrow <36879844+NeverKnowsTomorrow@users.noreply.github.com>
2026-11-19 22:42:00 +08:00

41 lines
1.4 KiB
Plaintext

package openidea:plugin@1.14.0;
/// Optional export (world `plugin-hover-actions`): clickable actions rendered
/// at the left edge of a line and revealed while the pointer is in the leftmost
/// editing-area strip of the action's line range.
interface hover-actions {
use language-features.{document};
/// An action drawn at the left edge of `line`.
record hover-action {
/// The line the button is drawn on; normally the declaration line.
line: u32,
/// First line whose left strip reveals this action, inclusive.
start-line: u32,
/// Last line whose left strip reveals this action, inclusive.
end-line: u32,
/// Optional icon: a registered icon name or a declared manifest SVG path.
icon: option<string>,
/// Text shown when no icon is present, or beside the icon.
label: string,
tooltip: option<string>,
/// This plugin's declared command.
command: string,
argument: option<string>,
}
/// Actions for the visible document, under the editor-provider budget.
hover-actions: func(doc: document) -> list<hover-action>;
}
/// The optional export-only world the SDK merges with `plugin`.
world hover-actions-provider {
export hover-actions;
}
/// The host-side world used to instantiate a component that exports it.
world plugin-hover-actions {
include plugin;
export hover-actions;
}