Файли
openidea/crates/ide-plugin/src/lib.rs
T
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 <[email protected]>
2026-11-06 10:07:53 +08:00

26 рядки
1020 B
Rust

//! The WebAssembly runtime for plugins (wasmtime, component model, WASI
//! preview 2). Package handling, extension points and grants live in
//! `ide-extension`; the host that assembles them is `ide-host::plugins`.
//!
//! Each plugin with code runs in its own wasmtime `Store`: no files, env or
//! network beyond what [`HostApi`] grants, a fuel budget and wall-clock
//! deadline per call, and a linear-memory cap. A trap (panic, budget
//! exhausted, permission violation, cancellation) poisons the instance; the
//! host drops it. Each active plugin's runtime lives on its own [`Actor`] thread.
mod actor;
pub mod indexing;
mod runtime;
mod sandbox;
mod types;
mod wit_host;
pub use actor::{Actor, ActorError, Pending};
pub use runtime::{
API_VERSION, CANCELLED, CallCancel, CallError, GuestError, HostApi, PluginEngine, Runtime, RuntimeSetup, check_api,
component_api, host_api,
};
pub use sandbox::{MAX_READ_BYTES, read_text, resolve_in_root};
pub use types::*;
pub use wasmtime::component::Component;