дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-08 19:02:17 +02: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.
61 рядки
2.1 KiB
Plaintext
61 рядки
2.1 KiB
Plaintext
package openidea:[email protected];
|
|
|
|
/// Cross-file associations a plugin publishes for the files it declares under
|
|
/// `[[contributes.documentIndexers]]`. The host calls `index` in cancellable
|
|
/// background batches (on project open, then for changed files), keeps the
|
|
/// project-wide graph, and answers Go to Declaration and gutter markers from
|
|
/// it without calling the plugin again. Requires `project.read`; trusted
|
|
/// projects only.
|
|
interface document-indexer {
|
|
use types.{range};
|
|
|
|
/// A symbol the host's syntax support found in the document.
|
|
record symbol {
|
|
name: string,
|
|
/// class, interface, method, field, … as in the structure view.
|
|
kind: string,
|
|
/// The enclosing symbol's name.
|
|
container: option<string>,
|
|
range: range,
|
|
}
|
|
|
|
/// The document to index: the editor's text while it is open, else the file's.
|
|
record document {
|
|
/// Absolute path.
|
|
path: string,
|
|
text: string,
|
|
symbols: list<symbol>,
|
|
}
|
|
|
|
/// A range of the document tied to a key the plugin chooses
|
|
/// (`com.example.UserMapper#findById`, say). Keys are compared as is.
|
|
record anchor {
|
|
key: string,
|
|
range: range,
|
|
}
|
|
|
|
/// Keys starting with `prefix` also resolve as if they started with
|
|
/// `target`; both end with `#`. A mapper that extends another finds the
|
|
/// inherited statements this way.
|
|
record alias {
|
|
prefix: string,
|
|
target: string,
|
|
}
|
|
|
|
/// What one document contributes; replaces its previous edges.
|
|
record edges {
|
|
/// Where keys are declared.
|
|
definitions: list<anchor>,
|
|
/// Ranges that go to the definitions of their key (Go to Declaration,
|
|
/// Ctrl/⌘-click). Elsewhere the language server answers as usual.
|
|
references: list<anchor>,
|
|
aliases: list<alias>,
|
|
/// Gutter icons on their first line that go to the definitions of their key.
|
|
markers: list<anchor>,
|
|
}
|
|
|
|
/// At most 4,096 definitions and references and 256 aliases per document;
|
|
/// a document over the limits is reported as not indexed.
|
|
index: func(doc: document) -> edges;
|
|
}
|