Files
openidea/wit/host.wit
l0ng-ai b550be9685 feat(plugins): open plugin API 1.2
API 1.1.0 shipped with 0.1.37 and its WIT is frozen in the released
snapshot, so additions now go into 1.2.0. The package version in wit/
and the SDK's copy, ENGINE_VERSION and both API_VERSION constants move to
1.2; the official plugins and test fixtures are rebuilt against it.

No interface, type or function changes: 1.0 and 1.1 components keep
linking. The release that ships 1.2 copies wit/ over
sdk/rust/openidea-plugin/tests/api/released/.
2026-11-06 09:29:03 +08:00

43 lines
1.5 KiB
Plaintext

package openidea:plugin@1.2.0;
/// Writes to the IDE log, tagged with the plugin id.
interface log {
use types.{log-level};
log: func(level: log-level, message: string);
}
interface ui {
use types.{error, notification-level};
record status-item {
text: string,
tooltip: option<string>,
/// One of the plugin's commands, run when the item is clicked.
command: option<string>,
}
/// Shows a notification balloon in the window the current command or
/// event came from (every window when there is none).
show-notification: func(level: notification-level, title: string, body: string);
/// Shows or updates the plugin's status bar item `id` in every window.
set-status-item: func(id: string, item: status-item);
remove-status-item: func(id: string);
/// Copies `text` to the system clipboard. Requires `clipboard`.
copy-to-clipboard: func(text: string) -> result<_, error>;
/// Opens an `http://` or `https://` URL in the user's default browser.
open-url: func(url: string) -> result<_, error>;
}
/// Persistent key-value storage of the plugin (survives restarts and idle
/// reclaim; instance memory does not). Requires `storage`. At most 1 MiB.
interface storage {
use types.{error};
get: func(key: string) -> result<option<string>, error>;
set: func(key: string, value: string) -> result<_, error>;
delete: func(key: string) -> result<_, error>;
/// Keys starting with `prefix`, sorted.
keys: func(prefix: string) -> result<list<string>, error>;
}