mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-06 08:07:49 +00:00
A plugin system built on WebAssembly components (wasmtime, WASI p2), with a typed WIT API (`openidea:plugin@1.0.0`) and a Rust SDK, shipped as a preview. - Extension points declared in `plugin.toml` (commands, languages, themes, icon themes, menus, key bindings, status items, settings, views, custom editors, file icons and templates, run detectors, editor providers), validated before anything takes effect and projected onto the workbench's own registries: plugin themes and file icon themes are chosen in Settings › Appearance and Quick Switch, plugin shortcuts are edited in Settings › Keymap, plugin problems are grouped in Settings › Inspections. - Capabilities with risk levels and consent at install, pinned `process:` programs, secrets in the OS keychain. - Runtime: one thread per active plugin, fuel/time/memory budgets, soft and hard deadlines on the editing path, cancellation, crash backoff, idle reclaim, a precompiled-component cache; remote projects run code plugins on `openidea-server`. - Web views and custom editors with a sandboxed page, a document bridge joined to the text editor's undo history, and split or preview layouts. - Distribution: signed `.oiplugin` packages, a static marketplace index with revocation, versioned installs with rollback, install from a `.zip` or a folder. The release workflow signs and publishes the official plugins and their index, which released builds use as the default marketplace. - Official plugins: String Tools, Key Promoter, Git Toolbox, AI Completion, Checkstyle, MyBatis Navigator, CSV Editor, Solidity, Material Icons, Harbor Night, Excalidraw, Graphviz, Regex Tester, License Header. Closes #732 Co-authored-by: Deng Liu <5108773+dengliu@users.noreply.github.com> Co-authored-by: florentvdry <16673235+florentvdry@users.noreply.github.com>
86 lines
2.5 KiB
Plaintext
86 lines
2.5 KiB
Plaintext
package openidea:plugin@1.0.0;
|
||
|
||
/// Problems in files, shown in the editor and the Problems view.
|
||
interface diagnostics {
|
||
use types.{error, range};
|
||
|
||
enum severity {
|
||
error,
|
||
warning,
|
||
info,
|
||
hint,
|
||
}
|
||
|
||
record diagnostic {
|
||
range: range,
|
||
severity: severity,
|
||
message: string,
|
||
/// Rule or check id (`LineLength`).
|
||
code: option<string>,
|
||
}
|
||
|
||
/// Replaces the plugin's diagnostics for the file at `path` (absolute, in
|
||
/// an open project); an empty list clears them. Requires `project.read`.
|
||
publish: func(path: string, diagnostics: list<diagnostic>) -> result<_, error>;
|
||
}
|
||
|
||
/// HTTP(S) to the hosts granted with `net:<host>`.
|
||
interface net {
|
||
use types.{error};
|
||
|
||
record header {
|
||
name: string,
|
||
value: string,
|
||
}
|
||
|
||
record request {
|
||
method: string,
|
||
/// `https://…`; plain `http://` only to `localhost` / `127.0.0.1`.
|
||
url: string,
|
||
/// `{{secret:<name>}}` in a value is replaced by the plugin's secret
|
||
/// `name` on the way out (requires `secrets`); the plugin never sees it.
|
||
headers: list<header>,
|
||
body: option<list<u8>>,
|
||
/// Default 30 s; the call's own budget applies too.
|
||
timeout-ms: option<u32>,
|
||
}
|
||
|
||
record response {
|
||
status: u16,
|
||
headers: list<header>,
|
||
/// At most 8 MiB.
|
||
body: list<u8>,
|
||
}
|
||
|
||
/// Fails with `denied` for a host the plugin may not reach, `cancelled`
|
||
/// when a newer request replaced the call or the user cancelled.
|
||
fetch: func(req: request) -> result<response, error>;
|
||
}
|
||
|
||
/// Secrets the user stored for the plugin (Settings › Plugins, kept in the
|
||
/// OS keychain). Plugins only use them through `{{secret:<name>}}` in
|
||
/// `net` requests. Requires `secrets`.
|
||
interface secrets {
|
||
is-set: func(name: string) -> bool;
|
||
}
|
||
|
||
/// One-off runs of programs granted with `process:<program>` (the file the
|
||
/// user approved, checked before every run).
|
||
interface process {
|
||
use types.{error};
|
||
use workspace.{project};
|
||
|
||
record output {
|
||
/// `none` when killed by a signal.
|
||
status: option<s32>,
|
||
/// At most 4 MiB each (the rest is dropped).
|
||
stdout: string,
|
||
stderr: string,
|
||
}
|
||
|
||
/// Runs `program` with `args` in `cwd`'s root (else the plugin's data
|
||
/// directory) and waits; cancelled with the task or call. Call it inside
|
||
/// a task for anything slow.
|
||
run: func(program: string, args: list<string>, cwd: option<borrow<project>>, stdin: option<string>) -> result<output, error>;
|
||
}
|