Файли
openidea/crates/ide-plugin/src/lib.rs
T
LU XIANGRUIтаwildcatDownstairs 749c34df7a feat(plugins): add views.set-badge API for plugin tool window badges (#8165)
Adds `views.set-badge` (`host::set_view_badge`) to plugin API 1.21: a plugin sets or clears a short badge on the stripe icon of one of its declared `[[contributes.views]]` tool windows, per invoking window, without a capability. Text is at most 4 characters (no control characters), numbers above 99 show as "99+", and `None`, "" or "0" clear it. Badges are dropped when the plugin is disabled, reloaded or uninstalled and when the window closes; a window reads the current set with `plugin_view_badges` and follows `ViewBadgeChanged` events. Plugin views reuse the workbench `StripeBadge` (honouring Show tool window badges); grouped views show each member's badge on its tab and an aggregate on the stripe.

Closes #8006

Co-authored-by: wildcatDownstairs <[email protected]>
2026-12-05 13:58:37 +08:00

45 рядки
1.7 KiB
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;
pub mod search;
mod types;
mod wit_host;
pub use actor::{Actor, ActorError, Pending};
pub use runtime::{
API_VERSION, CANCELLED, CallCancel, CallError, GuestError, HostApi, MAX_CLIPBOARD_BYTES, PluginEngine, Runtime,
RuntimeSetup, SettingsTarget, check_api, component_api, host_api,
};
pub use sandbox::{
MAX_READ_BYTES, Refusal, inside_root, inside_roots, read_text, resolve_granted, resolve_in_root, resolve_in_roots,
resolve_new_in_root, resolve_new_in_roots, resolve_real, resolve_writable, resolve_writable_in_root,
resolve_writable_in_roots,
};
pub use types::*;
pub use wasmtime::component::Component;
pub use wit_host::normalize_view_badge;
mod execution;
pub use execution::*;
mod syntax_decorations;
pub use syntax_decorations::{
MAX_SYNTAX_MARKS, MAX_SYNTAX_NAME, MAX_SYNTAX_NODES, MAX_SYNTAX_RANGES, SYNTAX_TOKENS, SyntaxSnapshotError,
filter_syntax_marks, syntax_foreground, syntax_token_allowed, validate_syntax_snapshot,
};
pub use ide_core::remote_settings::PluginRunTarget;
pub mod language_features;