mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-08 08:52:12 +00:00
Plugin API 1.3 adds an optional semantic-tokens-provider export (world plugin-semantic-tokens). A plugin declares the semantic-tokens kind under [[contributes.providers]] for any language, including ones it does not contribute, and returns single-line tokens with LSP token kinds and modifiers. The host asks it with the other editor providers (50 ms / 500 ms) when the editor requests semantic tokens and joins the result with the language server's: plugin tokens replace the server tokens they overlap, so the colour scheme styles them like any semantic token. Declaring the kind needs engines.openidea ^1.3. API 1.2 shipped with 0.1.38, so wit/ and the SDK's copy, ENGINE_VERSION and both API_VERSION constants move to 1.3 and every shipped component is rebuilt. The SDK gains openidea_plugin::semantic_tokens, and register_plugin! accepts any combination of optional exports (providers, views, indexing, syntax, semantic_tokens) instead of a fixed list of pairs.
55 lines
2.1 KiB
Plaintext
55 lines
2.1 KiB
Plaintext
package openidea:[email protected];
|
|
|
|
/// Workbench events, delivered in batches to `event-handler.handle`.
|
|
interface events {
|
|
use types.{error, extension};
|
|
|
|
record action-performed {
|
|
/// Action id (`editor.duplicate-line`).
|
|
action: string,
|
|
title: string,
|
|
/// How the user started it: `keyboard`, `menu`, `toolbar`,
|
|
/// `context-menu`, `search` or `other` (more may be added).
|
|
source: string,
|
|
/// Its keyboard shortcut, when it has one (`Ctrl+D`).
|
|
shortcut: option<string>,
|
|
}
|
|
|
|
variant event {
|
|
file-opened(string),
|
|
file-saved(string),
|
|
editor-focused(option<string>),
|
|
action-performed(action-performed),
|
|
vcs-changed(string),
|
|
scheduled,
|
|
/// A kind added after 1.0 (subscribed to by its name).
|
|
other(extension),
|
|
}
|
|
|
|
/// Delivers `kind` events from now on, for the rest of the session (also
|
|
/// across idle reclaim: an event activates the plugin again). Declare
|
|
/// `activation = ["on-event:<kind>"]` to get them before first use.
|
|
/// Kinds: `file-opened`, `file-saved`, `editor-focused` (the focused editor
|
|
/// changed), `vcs-changed` (a repository's state changed: commit,
|
|
/// checkout, fetch…), `action-performed` (an IDE action ran) and
|
|
/// `scheduled` (the `on-schedule` period elapsed); later IDEs add more,
|
|
/// and an IDE that doesn't know one fails with `invalid`.
|
|
/// Requires `events` (`events.input` for `action-performed`).
|
|
subscribe: func(kind: string) -> result<_, error>;
|
|
unsubscribe: func(kind: string);
|
|
}
|
|
|
|
/// Long-running work with a progress indicator. While a task is open, the
|
|
/// call that began it may run for the background budget (60 s) instead of 5 s.
|
|
interface tasks {
|
|
resource task {
|
|
/// `done` of `total` units (`none`: indeterminate), with a short status.
|
|
report: func(done: u32, total: option<u32>, message: option<string>);
|
|
/// The user cancelled it: stop soon and return.
|
|
is-cancelled: func() -> bool;
|
|
}
|
|
|
|
/// Starts a task shown in the status bar; dropping it ends it.
|
|
begin: func(title: string, cancellable: bool) -> task;
|
|
}
|