mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-07 00:16:56 +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.
81 lines
3.4 KiB
Plaintext
81 lines
3.4 KiB
Plaintext
package openidea:[email protected];
|
|
|
|
/// 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>,
|
|
}
|
|
|
|
record pick-item {
|
|
/// Returned when the item is chosen.
|
|
key: string,
|
|
label: string,
|
|
description: option<string>,
|
|
}
|
|
|
|
/// A context key's value, as `when` clauses compare it.
|
|
variant context-value {
|
|
flag(bool),
|
|
/// A finite number.
|
|
number(f64),
|
|
/// At most 1024 bytes.
|
|
text(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);
|
|
/// Sets the plugin's context key `key`, which `when` clauses test as
|
|
/// `plugin.<id>.<key>`, in the window the current command or event came
|
|
/// from (every window when there is none). A window's value takes
|
|
/// precedence over the global one. `key` is 1-64 of `A-Za-z0-9_-`; at most
|
|
/// 100 keys; they go away when the plugin stops.
|
|
set-context: func(key: string, value: context-value) -> result<_, error>;
|
|
/// Removes the key `set-context` set in the same scope.
|
|
remove-context: func(key: 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>;
|
|
/// Shows a list in the window the current command or event came from and
|
|
/// waits for the key of the chosen item, or `none` when the user dismisses
|
|
/// it. Needs no capability. Returns `invalid` outside a command or event of
|
|
/// a window (including in editor providers). Waiting doesn't count against
|
|
/// the call's budget.
|
|
pick: func(title: string, items: list<pick-item>) -> result<option<string>, error>;
|
|
/// Like `pick`, with any number of items chosen.
|
|
pick-many: func(title: string, items: list<pick-item>) -> result<option<list<string>>, error>;
|
|
/// Asks for a line of text, pre-filled with `value`; `none` when dismissed.
|
|
/// Same rules as `pick`.
|
|
input: func(prompt: string, value: option<string>) -> result<option<string>, error>;
|
|
/// Asks for confirmation with OK and Cancel: `true` on OK, `false` on
|
|
/// Cancel or Escape. Same rules as `pick`.
|
|
confirm: func(title: string, body: string) -> result<bool, 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>;
|
|
}
|