Files
qiaojianlong ed08b96382 feat(plugins): add background document-indexer API (#1021)
Plugin API 1.2 gains an optional document-indexer export (plugin-indexing world). A plugin returns per document the keys it defines and refers to, aliases between key prefixes and gutter markers; the host indexes a trusted project in cancellable background batches, keeps the project-wide graph, and answers Go to Declaration / Ctrl-click and multi-target gutter markers from memory without calling the plugin again. Edits and file changes invalidate the affected entries; reload, disable or a failing runtime drops the plugin's graph.

The interface is limited to cross-file associations: icons chosen by file content and embedded-language regions are separate concerns for later interfaces. The plugin navigation choosers' titles are translated.

Co-authored-by: qjlqyf <109515705+qjlqyf@users.noreply.github.com>
2026-11-06 10:07:53 +08:00

79 lines
2.1 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:plugin@1.2.0;
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;
}
/// 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;
}