mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-06 16:08:05 +00:00
Plugin API (breaking; the plugin system is unreleased): - Remove the runtime `contributions` interface (register-command, register-language, register-theme). Commands, languages and themes are declared in plugin.toml only, so everything a plugin contributes goes through the install preview and consent. The registry drops runtime scope, `contribute` and `dispose_runtime`; inline `definition` in language and theme declarations is gone. - `completion-item.kind` is a string (the 25 LSP kinds; unknown kinds show no icon), like the other open-ended kinds. - `lifecycle.activate` and `commands.run` return `types.error` instead of a string. The host maps it to the matching error kind, and only `failed` counts against the plugin: cancelling, a missing grant or an unknown command does not. The SDK's `Plugin` returns `Result<_, Error>`; plain messages convert to `Error::Failed`. Runtime: - Editor providers of several plugins are called at the same time (`Actor::submit` + `Pending::wait`): the wait is the slowest plugin's, not the sum, so each gets the full edit-path budget. Versioning and tooling: - Components are checked at install and by `openidea-plugin check` for the plugin API they were built for; another major or a newer minor is refused with what to do. - Tests: the SDK's WIT matches the host's, a simulated next-minor host links every shipped component, every host function has an SDK wrapper, released APIs only grow (no snapshot until the first release). - plugins/build.sh builds every checked-in component, records a source fingerprint next to it, and `--check` fails on stale components; CI runs it plus fmt, clippy (host and wasm) and tests for the SDK, the official plugins and the fixtures. - The API evolution rules and the checklist for a new host function are in plugins/README.md; the design notes under docs/ are removed.
70 lines
2.4 KiB
Plaintext
70 lines
2.4 KiB
Plaintext
package openidea:plugin@1.0.0;
|
|
|
|
/// Editor features a plugin provides for the languages it declares under
|
|
/// `[[contributes.providers]]` (the host calls only declared kinds). They run
|
|
/// on the editing path: a result later than ~50 ms is dropped, a call still
|
|
/// running at 500 ms is interrupted.
|
|
interface providers {
|
|
use types.{position, range, text-edit, location};
|
|
|
|
/// The document a request is about.
|
|
record document {
|
|
path: string,
|
|
language: string,
|
|
version: u64,
|
|
text: string,
|
|
}
|
|
|
|
record completion-item {
|
|
label: string,
|
|
detail: option<string>,
|
|
/// Icon and sort group: text, method, function, constructor, field,
|
|
/// variable, class, interface, module, property, unit, value, enum,
|
|
/// keyword, snippet, color, file, reference, folder, enum-member,
|
|
/// constant, struct, event, operator or type-parameter. Unknown kinds
|
|
/// show no icon.
|
|
kind: option<string>,
|
|
insert-text: string,
|
|
/// Replaced on accept; `none`: the word at the caret.
|
|
replace: option<range>,
|
|
sort-text: option<string>,
|
|
documentation: option<string>,
|
|
}
|
|
|
|
record inline-suggestion {
|
|
insert-text: string,
|
|
/// Replaced range; `none` inserts at the caret.
|
|
replace: option<range>,
|
|
}
|
|
|
|
record file-edit {
|
|
path: string,
|
|
edits: list<text-edit>,
|
|
}
|
|
|
|
record code-action {
|
|
title: string,
|
|
/// `quickfix`, `refactor`, …
|
|
kind: option<string>,
|
|
preferred: bool,
|
|
edits: list<file-edit>,
|
|
}
|
|
|
|
record line-marker {
|
|
line: u32,
|
|
/// Gutter icon: `navigate` (default), `implemented`, `implementing`, `run`.
|
|
icon: option<string>,
|
|
tooltip: string,
|
|
/// Opened on click.
|
|
target: option<location>,
|
|
}
|
|
|
|
completion: func(doc: document, at: position, trigger: option<string>) -> list<completion-item>;
|
|
/// Ghost text at the caret (typing replaces an older request: it is cancelled).
|
|
inline-completion: func(doc: document, at: position) -> option<inline-suggestion>;
|
|
/// Actions for `selection` (quick fixes for the plugin's own diagnostics).
|
|
code-actions: func(doc: document, selection: range) -> list<code-action>;
|
|
definition: func(doc: document, at: position) -> list<location>;
|
|
line-markers: func(doc: document) -> list<line-marker>;
|
|
}
|