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.
88 lines
2.2 KiB
Plaintext
88 lines
2.2 KiB
Plaintext
/// OpenIDEA plugin API, version 1.0. Once released, 1.x only adds (new
|
|
/// interfaces, new optional exports; plugins/README.md, "Evolving the plugin
|
|
/// API"); a 2.0 keeps 1.0 running through an adapter in the host.
|
|
///
|
|
/// A plugin is a WebAssembly component targeting the `plugin` world (or
|
|
/// `plugin-syntax`). It runs sandboxed: no filesystem, network, environment
|
|
/// or processes beyond WASI's clocks and randomness; everything else goes
|
|
/// through the imports below, gated by the capabilities granted in
|
|
/// `plugin.toml` (a missing one returns `error::denied`).
|
|
package openidea:[email protected];
|
|
|
|
world plugin {
|
|
import log;
|
|
import ui;
|
|
import storage;
|
|
import workspace;
|
|
import editor;
|
|
import invocation;
|
|
import vcs;
|
|
import events;
|
|
import tasks;
|
|
import diagnostics;
|
|
import net;
|
|
import secrets;
|
|
import process;
|
|
import views;
|
|
import settings;
|
|
|
|
export lifecycle;
|
|
export commands;
|
|
export event-handler;
|
|
}
|
|
|
|
/// A plugin that also provides syntax for its languages.
|
|
world plugin-syntax {
|
|
include plugin;
|
|
export syntax-provider;
|
|
}
|
|
|
|
/// A plugin with editor providers (`[[contributes.providers]]`).
|
|
world plugin-providers {
|
|
include plugin;
|
|
export providers;
|
|
}
|
|
|
|
/// A plugin with views or custom editors (`[[contributes.views]]`,
|
|
/// `[[contributes.custom-editors]]`).
|
|
world plugin-views {
|
|
include plugin;
|
|
export view-provider;
|
|
}
|
|
|
|
/// A plugin with a document indexer (`[[contributes.documentIndexers]]`).
|
|
world plugin-indexing {
|
|
include plugin;
|
|
export document-indexer;
|
|
}
|
|
|
|
world plugin-semantic-tokens {
|
|
include plugin;
|
|
export semantic-tokens-provider;
|
|
}
|
|
|
|
/// Only the `syntax-provider` export: guests generate it next to `plugin`
|
|
/// (the component tools merge both into one component).
|
|
world syntax {
|
|
export syntax-provider;
|
|
}
|
|
|
|
/// Only the `providers` export, generated next to `plugin` like `syntax`.
|
|
world editor-providers {
|
|
export providers;
|
|
}
|
|
|
|
/// Only the `view-provider` export, generated next to `plugin` like `syntax`.
|
|
world views-provider {
|
|
export view-provider;
|
|
}
|
|
|
|
/// Only the `document-indexer` export, generated next to `plugin` like `syntax`.
|
|
world indexing {
|
|
export document-indexer;
|
|
}
|
|
|
|
world semantic-tokens {
|
|
export semantic-tokens-provider;
|
|
}
|