Actions
Use hc.actions.register for lightweight commands discoverable from the Action menu (type #). Requires the ui permission. Actions do not need manifest.contributes.commands entries.
See UI for related contribution registrars.
hc.actions.register(namespace, handlers)
Available since v2.0.0
Signature:(namespace: string, handlers: Record<string, () => void | Promise<void>>) => Disposable
| Parameter | Type | Description |
|---|---|---|
namespace | string | Prefix shown before each action label |
handlers | Record<string, () => void | Promise<void>> | Action labels mapped to handlers run on selection |
Manifest: none. Requires the ui permission.
Registers plugin actions in HarborClient's Action menu. Users open the Action menu, type #, and see actions grouped as Namespace: Label.
Use this for lightweight commands that should be discoverable without adding a persistent menu item or toolbar button. Because actions are dynamic, they do not need manifest.contributes.commands entries, but the plugin must include the ui permission.
With that plugin installed, typing #curl in the Action menu shows:
cURL: ViewcURL: Close
hc.actions.register('cURL', {
View: () => {
hc.ui.showToast('Viewing generated cURL command');
},
Close: () => {
hc.ui.showToast('Closed cURL preview');
}
});