diff --git a/crates/ide-extension/src/manifest.rs b/crates/ide-extension/src/manifest.rs index 7885bfeaf7..88706eda42 100644 --- a/crates/ide-extension/src/manifest.rs +++ b/crates/ide-extension/src/manifest.rs @@ -34,7 +34,7 @@ use std::path::{Component, Path, PathBuf}; pub const MANIFEST_FILE: &str = "plugin.toml"; /// The plugin API (engine) version this host implements. -pub const ENGINE_VERSION: &str = "1.20.0"; +pub const ENGINE_VERSION: &str = "1.21.0"; /// The longest `[capabilities.reasons]` entry, in characters: a sentence or two. pub const MAX_CAPABILITY_REASON: usize = 500; /// The 0.1 API, still accepted for contribution-only packages and 0.1 components. @@ -168,6 +168,7 @@ impl ActivationEvent { pub const EVENT_KINDS: &[&str] = &[ "document-changed", "websocket-ready", + "run-started", "run-exited", "terminal-exited", "content-tab-action", @@ -475,6 +476,9 @@ impl Manifest { { self.needs_api(&format!("`{event}`"), 18)?; } + if matches!(event, ActivationEvent::Event(kind) if kind == "run-started") { + self.needs_api(&format!("`{event}`"), 21)?; + } if !seen.insert(event) { return Err(format!("duplicate activation event {event}")); } diff --git a/crates/ide-host/src/ops/run.rs b/crates/ide-host/src/ops/run.rs index 87a1c98577..76e301e952 100644 --- a/crates/ide-host/src/ops/run.rs +++ b/crates/ide-host/src/ops/run.rs @@ -327,6 +327,10 @@ pub async fn run_start( let _ = on_output.send(chunk); }); let operation = config.extras.params.get("plugin.operation").cloned(); + let plugin_debug = + config.extras.params.contains_key("__pluginJavaDebug") || config.extras.params.contains_key("__pluginDebug"); + let user_owner = if operation.is_none() { crate::plugins::plugin_run_config_owner(&config)? } else { None }; + let user_config_snap = user_owner.as_ref().map(|_| config.clone()); let mut config = config; let project = host.project(window)?; let agent = host.mcp_agent_runs.launch(&project.root, window, &mut config)?; @@ -351,8 +355,12 @@ pub async fn run_start( if let Some(id) = request { host.end_request(id); } - if let (Ok(info), Some(operation), Some(plugins)) = (&result, operation, host.plugin_host()) { - plugins.run_operation_started(window, &operation, info.id); + if let (Ok(info), Some(plugins)) = (&result, host.plugin_host()) { + if let Some(operation) = operation { + plugins.run_operation_started(window, &operation, info.id); + } else if let (Some(owner), Some(snap)) = (&user_owner, &user_config_snap) { + plugins.user_run_started(window, owner, snap, info.id, plugin_debug); + } } result } @@ -389,6 +397,7 @@ async fn start_inner( IdeError::new(ide_core::error::ErrorKind::PermissionDenied, "plugin host is not available") })?; direct_stop = plugins.authorize_run_config(&project.root, &owner, &mut config)?; + sink = plugins.user_run_exit_sink(window, &owner, &config, sink); plugin_authorized = true; } if let Some(agent) = agent { diff --git a/crates/ide-host/src/plugins/api.rs b/crates/ide-host/src/plugins/api.rs index 52d90926d9..374f703f60 100644 --- a/crates/ide-host/src/plugins/api.rs +++ b/crates/ide-host/src/plugins/api.rs @@ -763,6 +763,7 @@ pub(super) struct Shared { pub(super) run_configurations: super::run_detectors::DynamicConfigurations, pub(super) run_targets: Mutex, pub(super) operations: Mutex>, + pub(super) active_plugin_runs: Mutex>, pub(super) content_tabs: Mutex>, pub(super) content_requests: Mutex, @@ -873,6 +874,7 @@ impl Shared { run_configurations: Arc::default(), run_targets: Mutex::default(), operations: Mutex::default(), + active_plugin_runs: Mutex::default(), content_tabs: Mutex::default(), content_requests: Mutex::default(), @@ -1904,7 +1906,12 @@ impl HostApi for PluginApi { run.args.extend(args); let id = self.new_operation( client, - super::execution::OperationKind::Run { config: config.into(), configuration: run.id.clone(), program }, + super::execution::OperationKind::Run { + config: config.into(), + configuration: run.id.clone(), + program, + debug, + }, )?; run.extras.params.insert(super::execution::RUN_OPERATION.into(), id.clone()); let request = super::WindowRequest::Run { operation: id.clone(), config: Box::new(run), debug }; @@ -1914,6 +1921,80 @@ impl HostApi for PluginApi { ); Ok(id) } + + fn stop_run(&self, client: &str, id: &str, cancel: &CancellationToken, timeout: Duration) -> Result<(), HostError> { + self.require_api("`run.stop`", 21)?; + let target_id = { + let mut ops = self.shared.operations.lock(); + if let Some(op) = ops.get_mut(id).filter(|op| { + op.plugin == self.id() + && op.client == client + && matches!(op.kind, super::execution::OperationKind::Run { .. }) + }) { + op.closed = true; + Some(op.run.map_or_else(|| id.to_owned(), |r| r.0.to_string())) + } else { + None + } + } + .or_else(|| { + let mut runs = self.shared.active_plugin_runs.lock(); + runs.values_mut() + .find(|r| { + r.plugin == self.id() + && r.client == client + && (format!("run-{}", r.run_id.0) == id || r.run_id.0.to_string() == id) + }) + .map(|r| { + r.killed = true; + r.run_id.0.to_string() + }) + }); + let Some(target_id) = target_id else { + return Err(HostError::NotFound(format!("no active run `{id}`"))); + }; + let _ = self.window_request(client, super::WindowRequest::StopRun { id: target_id }, cancel, timeout)?; + Ok(()) + } + + fn upsert_run_configuration( + &self, + client: &str, + draft: ide_plugin::RunConfigDraft, + cancel: &CancellationToken, + timeout: Duration, + ) -> Result { + self.require_api("`run.upsert-configuration`", 21)?; + if !self + .shared + .ui + .items(super::ui_points::RUN_CONFIG_TYPES, Some(self.id())) + .iter() + .any(|i| i.key == draft.type_id) + { + return Err(HostError::Denied(format!( + "plugin {:?} does not declare run configuration type {:?}", + self.id(), + draft.type_id + ))); + } + self.window_request(client, super::WindowRequest::UpsertRunConfiguration { draft }, cancel, timeout)? + .filter(|s| !s.is_empty()) + .ok_or_else(|| HostError::Failed("window did not return saved configuration id".into())) + } + + fn open_edit_configurations( + &self, + client: &str, + config_id: Option, + cancel: &CancellationToken, + timeout: Duration, + ) -> Result<(), HostError> { + self.require_api("`run.open-edit-configurations`", 21)?; + let _ = + self.window_request(client, super::WindowRequest::OpenEditConfigurations { config_id }, cancel, timeout)?; + Ok(()) + } fn open_terminal_session( &self, client: &str, diff --git a/crates/ide-host/src/plugins/commands.rs b/crates/ide-host/src/plugins/commands.rs index 9be5e95fc6..3232e0c697 100644 --- a/crates/ide-host/src/plugins/commands.rs +++ b/crates/ide-host/src/plugins/commands.rs @@ -412,6 +412,59 @@ pub async fn plugin_debug_attach_target( blocking(move || plugins.debug_attach_target(&host, &client, &config, run)).await } +/// Bounded slice of a log file tailed for a plugin run console tab. +#[derive(Clone, Debug, Default, serde::Serialize, specta::Type)] +#[serde(rename_all = "camelCase")] +pub struct PluginLogTailChunk { + pub content: String, + pub offset: u64, + pub truncated: bool, + pub exists: bool, +} + +/// Reads an incremental chunk of an authorized log file for a plugin run session. +#[command(trust = trusted)] +pub async fn plugin_run_log_tail( + host: &Arc, + plugins: &Arc, + window: &str, + plugin_id: String, + path: String, + offset: u64, + max_bytes: Option, +) -> IdeResult { + host.require_trust(window)?; + let project = host.project(window)?; + let plugins = plugins.clone(); + let root = project.root.clone(); + blocking(move || { + use std::io::{Read, Seek, SeekFrom}; + let (resolved, exists) = plugins.authorize_run_log_read(&plugin_id, &root, &path)?; + if !exists || !resolved.is_file() { + return Ok(PluginLogTailChunk { content: String::new(), offset: 0, truncated: false, exists: false }); + } + let mut file = std::fs::File::open(&resolved)?; + let len = file.metadata()?.len(); + let (start, truncated) = if offset > len { (0, true) } else { (offset, false) }; + file.seek(SeekFrom::Start(start))?; + let cap = usize::try_from(max_bytes.unwrap_or(131_072).min(262_144)).unwrap_or(131_072); + let mut buf = vec![0u8; cap]; + let n = file.read(&mut buf)?; + buf.truncate(n); + // Leave a character cut by the chunk size for the next read. + if let Err(e) = std::str::from_utf8(&buf) + && e.error_len().is_none() + && e.valid_up_to() > 0 + { + buf.truncate(e.valid_up_to()); + } + let n = buf.len(); + let content = String::from_utf8_lossy(&buf).into_owned(); + Ok(PluginLogTailChunk { content, offset: start + n as u64, truncated, exists: true }) + }) + .await +} + ide_command::domain!( plugins_commands: plugin_answer_clipboard, @@ -435,6 +488,7 @@ ide_command::domain!( plugin_run_anything_suggest, plugin_run_command, plugin_run_configuration_complete, + plugin_run_log_tail, plugin_select_tests, plugin_set_active_file, plugin_set_ui_locale, diff --git a/crates/ide-host/src/plugins/execution.rs b/crates/ide-host/src/plugins/execution.rs index c7dc7c1b8d..a6ffaa59fd 100644 --- a/crates/ide-host/src/plugins/execution.rs +++ b/crates/ide-host/src/plugins/execution.rs @@ -18,8 +18,16 @@ pub(super) struct Operation { pub terminal: Option<(std::sync::Weak, ide_core::TerminalId)>, } +pub(super) struct ActivePluginRun { + pub plugin: String, + pub client: String, + pub config: String, + pub run_id: ide_core::RunId, + pub killed: bool, +} + pub(super) enum OperationKind { - Run { config: String, configuration: String, program: String }, + Run { config: String, configuration: String, program: String, debug: bool }, Terminal { key: String, command: ide_plugin::ProcessCommand }, } @@ -478,7 +486,7 @@ fn inherited_env(name: &str) -> bool { } /// Attach to Process kinds a configuration may attach to. -pub(super) const ATTACH_KINDS: [&str; 5] = ["dotnet", "node", "python", "go", "native"]; +pub(super) const ATTACH_KINDS: [&str; 6] = ["dotnet", "node", "python", "go", "native", "java"]; fn validate_debugger(debugger: Option<&ide_plugin::PluginDebugger>) -> Result<(), HostError> { match debugger { @@ -888,6 +896,8 @@ impl PluginHost { let binary = self.program_for_project(plugin, &program, Some(root))?; config.command = if has_target { program } else { binary.to_string_lossy().into_owned() }; config.detected = false; + config.extras.params.remove("__pluginJavaDebug"); + config.extras.params.remove("__pluginDebug"); plugin.as_str() } PluginRunConfigOwner::Detected { plugin, .. } => { @@ -1132,20 +1142,190 @@ impl PluginHost { Ok((wrapped, true, stop)) } pub(crate) fn run_operation_started(&self, client: &str, operation: &str, run: ide_core::RunId) { - if let Some(op) = self - .shared - .operations - .lock() - .get_mut(operation) - .filter(|op| op.client == client && matches!(op.kind, OperationKind::Run { .. })) - { - op.run = Some(run); + let started = { + let mut ops = self.shared.operations.lock(); + ops.get_mut(operation) + .filter(|op| op.client == client && matches!(op.kind, OperationKind::Run { .. })) + .and_then(|op| { + op.run = Some(run); + let OperationKind::Run { config, debug, .. } = &op.kind else { return None }; + Some((op.plugin.clone(), config.clone(), *debug)) + }) + }; + if let Some((plugin, config, debug)) = started { + self.emit_run_started_if_wanted(&plugin, client, operation.to_owned(), config, debug); } } + pub(crate) fn run_operation_stopped(&self, run: ide_core::RunId) { for op in self.shared.operations.lock().values_mut().filter(|op| op.run == Some(run)) { op.closed = true; } + if let Some(active) = self.shared.active_plugin_runs.lock().get_mut(&run) { + active.killed = true; + } + } + + fn emit_run_started_if_wanted(&self, plugin_id: &str, client: &str, id: String, config: String, debug: bool) { + let Some(plugin) = self.plugins.read().get(plugin_id).cloned() else { return }; + let wanted = { + let subs = self.shared.subscriptions.lock(); + Self::wants(&plugin, super::EventKind::RunStarted, subs.kinds.get(plugin_id)) + }; + if wanted { + self.post_owned_event( + plugin_id, + client, + WorkbenchEvent::RunStarted(ide_plugin::RunStarted { id, config, debug }), + ); + } + } + + fn owner_plugin_and_config(owner: &PluginRunConfigOwner, config: &ide_run::RunConfig) -> (String, String) { + match owner { + PluginRunConfigOwner::Detected { plugin, config_id } => (plugin.clone(), config_id.clone()), + PluginRunConfigOwner::CustomType { plugin, .. } => (plugin.clone(), config.id.clone()), + } + } + + /// Wraps `previous` so user-launched plugin runs emit `run-exited` if subscribed. + pub(crate) fn user_run_exit_sink( + self: &Arc, + client: &str, + owner: &PluginRunConfigOwner, + config: &ide_run::RunConfig, + previous: Arc, + ) -> Arc { + let (plugin_id, config_id) = Self::owner_plugin_and_config(owner, config); + let weak = Arc::downgrade(self); + let client = client.to_owned(); + Arc::new(move |event: ide_core::IdeEvent| { + if let ide_core::IdeEvent::RunExited { run, code } = &event + && let Some(plugins) = weak.upgrade() + { + let active = plugins.shared.active_plugin_runs.lock().remove(run); + let (cfg, killed) = match active { + Some(a) => (a.config, a.killed), + None => (config_id.clone(), false), + }; + // Plugins built for an older API only see `run-exited` for runs they started. + if let Some(plugin) = plugins + .plugins + .read() + .get(&plugin_id) + .filter(|p| p.manifest().needs_api("user-launched `run-exited`", 21).is_ok()) + .cloned() + { + let wanted = { + let subs = plugins.shared.subscriptions.lock(); + Self::wants(&plugin, super::EventKind::RunExited, subs.kinds.get(&plugin_id)) + }; + if wanted { + plugins.post_owned_event( + &plugin_id, + &client, + WorkbenchEvent::RunExited(ide_plugin::RunExited { + id: format!("run-{}", run.0), + config: cfg, + status: *code, + killed, + }), + ); + } + } + } + previous.emit(event); + }) + } + + /// Records a user-launched plugin run as active and emits `run-started` if subscribed. + pub(crate) fn user_run_started( + &self, + client: &str, + owner: &PluginRunConfigOwner, + config: &ide_run::RunConfig, + run_id: ide_core::RunId, + debug: bool, + ) { + let (plugin, cfg) = Self::owner_plugin_and_config(owner, config); + self.shared.active_plugin_runs.lock().insert( + run_id, + ActivePluginRun { + plugin: plugin.clone(), + client: client.to_owned(), + config: cfg.clone(), + run_id, + killed: false, + }, + ); + self.emit_run_started_if_wanted(&plugin, client, format!("run-{}", run_id.0), cfg, debug); + } + + /// Authorizes reading a log file for `plugin_id` in `project_root` via either + /// `project.read` (inside the project) or an active `fs.read:` grant. + /// Returns `(resolved_path, exists)`. + pub(crate) fn authorize_run_log_read( + &self, + plugin_id: &str, + project_root: &std::path::Path, + asked: &str, + ) -> IdeResult<(std::path::PathBuf, bool)> { + if asked.trim().is_empty() || asked.contains('\0') { + return Err(IdeError::invalid("invalid log file path")); + } + let loaded = self.get(plugin_id)?; + if !loaded.status().is_live() { + return Err(IdeError::new( + ide_core::error::ErrorKind::PermissionDenied, + format!("plugin {plugin_id:?} is not enabled"), + )); + } + let grant = self.ledger.lock().get(&loaded.subject()).cloned(); + let Some(grant) = grant.filter(|g| g.confirmed) else { + return Err(IdeError::new( + ide_core::error::ErrorKind::PermissionDenied, + format!("plugin {plugin_id:?} is not confirmed"), + )); + }; + if grant.has(&ide_extension::Capability::ProjectRead) { + if let Ok(existing) = ide_plugin::resolve_in_root(project_root, asked) { + return Ok((existing, true)); + } + if let Ok(missing) = ide_plugin::resolve_writable_in_root(project_root, asked) { + return Ok((missing, false)); + } + } + let read_caps: Vec = loaded + .manifest() + .capabilities + .all() + .filter(|c| matches!(c, ide_extension::Capability::FsRead(_)) && grant.has(c)) + .cloned() + .collect(); + if !read_caps.is_empty() { + match ide_plugin::resolve_granted(&read_caps, asked) { + Ok(real) => return Ok((real, true)), + Err(ide_plugin::Refusal::Denied(cap)) => { + return Err(IdeError::new(ide_core::error::ErrorKind::PermissionDenied, format!("denied {cap}"))); + } + Err(ide_plugin::Refusal::Invalid(_)) => { + let write_caps: Vec<_> = read_caps + .iter() + .filter_map(|c| match c { + ide_extension::Capability::FsRead(p) => Some(ide_extension::Capability::FsWrite(p.clone())), + _ => None, + }) + .collect(); + if let Ok(missing) = ide_plugin::resolve_writable(&write_caps, asked) { + return Ok((missing, false)); + } + } + } + } + Err(IdeError::new( + ide_core::error::ErrorKind::PermissionDenied, + format!("plugin {plugin_id:?} lacks project.read or fs.read permission for {asked}"), + )) } } @@ -1235,7 +1415,8 @@ mod tests { for kind in ATTACH_KINDS { assert!(ok(AttachChild { kind: kind.into(), command_contains: None }), "{kind}"); } - assert!(!ok(AttachChild { kind: "java".into(), command_contains: None })); + assert!(ok(AttachChild { kind: "java".into(), command_contains: None })); + assert!(!ok(AttachChild { kind: "ruby".into(), command_contains: None })); assert!(ok(AttachChild { kind: "dotnet".into(), command_contains: Some("Worker.dll".into()) })); assert!(!ok(AttachChild { kind: "dotnet".into(), command_contains: Some(String::new()) })); } diff --git a/crates/ide-host/src/plugins/mod.rs b/crates/ide-host/src/plugins/mod.rs index 39b8d43519..86d43b2634 100644 --- a/crates/ide-host/src/plugins/mod.rs +++ b/crates/ide-host/src/plugins/mod.rs @@ -2226,7 +2226,8 @@ impl PluginHost { .filter(|e| { !matches!( e, - WorkbenchEvent::RunExited(_) + WorkbenchEvent::RunStarted(_) + | WorkbenchEvent::RunExited(_) | WorkbenchEvent::TerminalExited(_) | WorkbenchEvent::ContentTabAction(_) ) @@ -2356,6 +2357,7 @@ impl PluginHost { event, WorkbenchEvent::FilesChanged(_) | WorkbenchEvent::WatchedFilesChanged(_) + | WorkbenchEvent::RunStarted(_) | WorkbenchEvent::RunExited(_) | WorkbenchEvent::TerminalExited(_) | WorkbenchEvent::ContentTabAction(_) @@ -2583,7 +2585,13 @@ impl PluginHost { && !kinds.contains(&EventKind::Scheduled) && !kinds.contains(&EventKind::FilesChanged) && !kinds.iter().any(|k| { - matches!(k, EventKind::RunExited | EventKind::TerminalExited | EventKind::ContentTabAction) + matches!( + k, + EventKind::RunStarted + | EventKind::RunExited + | EventKind::TerminalExited + | EventKind::ContentTabAction + ) }) { actor.cancel_soft(); diff --git a/crates/ide-host/src/plugins/types.rs b/crates/ide-host/src/plugins/types.rs index 8f162d822d..44484dec38 100644 --- a/crates/ide-host/src/plugins/types.rs +++ b/crates/ide-host/src/plugins/types.rs @@ -587,4 +587,11 @@ pub enum WindowRequest { env: BTreeMap, cwd: ide_core::IpcPath, }, + /// Stop an active run/debug session belonging to this plugin (API 1.21). + StopRun { id: String }, + /// Create or update a saved run configuration for one of this plugin's own types (API 1.21). + UpsertRunConfiguration { draft: ide_plugin::RunConfigDraft }, + /// Open Run/Debug Configurations dialog, optionally selecting `config_id` (API 1.21). + #[serde(rename_all = "camelCase")] + OpenEditConfigurations { config_id: Option }, } diff --git a/crates/ide-host/src/plugins/ui_points.rs b/crates/ide-host/src/plugins/ui_points.rs index a5bc45228a..1ecc4e1e72 100644 --- a/crates/ide-host/src/plugins/ui_points.rs +++ b/crates/ide-host/src/plugins/ui_points.rs @@ -127,7 +127,9 @@ const SERVICES_MENUS: [&str; 2] = ["services.context", "services.toolbar"]; const OPEN_IN_MENU: &str = "openIn"; /// Context menu of tables/views in the Database tool window (API 1.20). const DATABASE_TABLE_MENU: &str = "database.table.context"; -const MENU_IDS: [&str; 14] = [ +/// Toolbar of the Run and Debug consoles (API 1.21). +const RUN_CONSOLE_TOOLBAR_MENU: &str = "runConsole.toolbar"; +const MENU_IDS: [&str; 15] = [ "editor.context", "projectView.context", "editorTab.context", @@ -142,6 +144,7 @@ const MENU_IDS: [&str; 14] = [ SERVICES_MENUS[1], OPEN_IN_MENU, DATABASE_TABLE_MENU, + RUN_CONSOLE_TOOLBAR_MENU, ]; const MAX_TITLE: usize = 256; const MAX_SETTINGS: usize = 200; @@ -215,6 +218,9 @@ pub(super) fn menu(pkg: &Package, decl: toml::Value) -> Result { if d.menu == OPEN_IN_MENU { pkg.manifest.needs_api(&format!("contributes.menus: {OPEN_IN_MENU}"), 19)?; } + if d.menu == RUN_CONSOLE_TOOLBAR_MENU { + pkg.manifest.needs_api(&format!("contributes.menus: {RUN_CONSOLE_TOOLBAR_MENU}"), 21)?; + } if let Some(w) = &d.when { validate_when(w).map_err(|e| format!("contributes.menus: {e}"))?; } @@ -1071,6 +1077,8 @@ struct RunConfigTypeDecl { owns_working_directory: bool, #[serde(default, skip_serializing_if = "is_false")] owns_environment: bool, + #[serde(default, skip_serializing_if = "is_false")] + owns_before_launch: bool, #[serde(default, skip_serializing_if = "Option::is_none")] prepare_command: Option, #[serde(default, skip_serializing_if = "Option::is_none")] @@ -1086,6 +1094,9 @@ const RUN_CONFIG_HEIGHT: std::ops::RangeInclusive = 120..=1200; pub(super) fn run_config_type(pkg: &Package, decl: toml::Value) -> Result { let d: RunConfigTypeDecl = decode(RUN_CONFIG_TYPES, decl)?; pkg.manifest.needs_api(&format!("contributes.{RUN_CONFIG_TYPES}"), 20)?; + if d.owns_before_launch { + pkg.manifest.needs_api("runConfigTypes.ownsBeforeLaunch", 21)?; + } validate_item_id(&d.id, "run config type id")?; let what = format!("run config type {:?}", d.id); for point in [VIEWS, CUSTOM_EDITORS, EDITOR_PANELS, OVERLAYS, DIALOGS] { @@ -2162,4 +2173,48 @@ title = \"Prepare\"\n" assert!(locales(&pkg, toml::Value::Table(Default::default())).is_err(), "{name}: {text}"); } } + + #[test] + fn run_console_toolbar_and_owns_before_launch_require_api_21() { + let dir = tempfile::tempdir().unwrap(); + std::fs::create_dir_all(dir.path().join("web")).unwrap(); + std::fs::write(dir.path().join("web/form.html"), "").unwrap(); + + let bad_menu = ide_extension::Manifest::parse( + "id = \"p\"\nname = \"P\"\nversion = \"1.0.0\"\nengines.openidea = \"^1.20\"\n\ + [[contributes.commands]]\nid = \"redeploy\"\ntitle = \"Redeploy\"\n\ + [[contributes.menus]]\nmenu = \"runConsole.toolbar\"\ncommand = \"redeploy\"\n", + ) + .unwrap(); + let decl = bad_menu.declarations(MENUS).into_iter().next().unwrap(); + assert!(menu(&Package::new(bad_menu, dir.path().to_path_buf()), decl).is_err()); + + let good_menu = ide_extension::Manifest::parse( + "id = \"p\"\nname = \"P\"\nversion = \"1.0.0\"\nengines.openidea = \"^1.21\"\n\ + [[contributes.commands]]\nid = \"redeploy\"\ntitle = \"Redeploy\"\n\ + [[contributes.menus]]\nmenu = \"runConsole.toolbar\"\ncommand = \"redeploy\"\n", + ) + .unwrap(); + let decl = good_menu.declarations(MENUS).into_iter().next().unwrap(); + assert!(menu(&Package::new(good_menu, dir.path().to_path_buf()), decl).is_ok()); + + let bad_rc = ide_extension::Manifest::parse( + "id = \"p\"\nname = \"P\"\nversion = \"1.0.0\"\nengines.openidea = \"^1.20\"\n\ + [[contributes.runConfigTypes]]\nid = \"t\"\nlabel = \"T\"\nweb = \"web/form.html\"\nownsBeforeLaunch = true\n", + ) + .unwrap(); + let decl = bad_rc.declarations(RUN_CONFIG_TYPES).into_iter().next().unwrap(); + assert!(run_config_type(&Package::new(bad_rc, dir.path().to_path_buf()), decl).is_err()); + + let good_rc = ide_extension::Manifest::parse( + "id = \"p\"\nname = \"P\"\nversion = \"1.0.0\"\nengines.openidea = \"^1.21\"\n\ + [[contributes.runConfigTypes]]\nid = \"t\"\nlabel = \"T\"\nweb = \"web/form.html\"\nownsBeforeLaunch = true\n", + ) + .unwrap(); + let decl = good_rc.declarations(RUN_CONFIG_TYPES).into_iter().next().unwrap(); + assert!( + run_config_type(&Package::new(good_rc, dir.path().to_path_buf()), decl).unwrap().json["ownsBeforeLaunch"] + == true + ); + } } diff --git a/crates/ide-plugin/src/execution.rs b/crates/ide-plugin/src/execution.rs index 5fcce51d92..d110fb5e4e 100644 --- a/crates/ide-plugin/src/execution.rs +++ b/crates/ide-plugin/src/execution.rs @@ -129,6 +129,30 @@ pub enum PluginDebugger { AttachChild { kind: String, command_contains: Option }, } +/// RunStarted data exchanged with the IDE (API 1.21). +#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, Type)] +#[serde(rename_all = "camelCase")] +pub struct RunStarted { + pub id: String, + pub config: String, + pub debug: bool, +} + +/// Draft passed to `run.upsert-configuration` (API 1.21). +#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, Type)] +#[serde(rename_all = "camelCase")] +pub struct RunConfigDraft { + pub id: Option, + pub type_id: String, + pub name: String, + pub command: Option, + pub args: Vec, + pub cwd: Option, + pub env: Vec<(String, String)>, + pub params: Vec<(String, String)>, + pub allow_parallel: bool, +} + /// RunExited data exchanged with the IDE. #[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, Type)] #[serde(rename_all = "camelCase")] diff --git a/crates/ide-plugin/src/lib.rs b/crates/ide-plugin/src/lib.rs index 4767eee8af..cc46db4cfb 100644 --- a/crates/ide-plugin/src/lib.rs +++ b/crates/ide-plugin/src/lib.rs @@ -22,8 +22,9 @@ pub use runtime::{ RuntimeSetup, SettingsTarget, check_api, component_api, host_api, }; pub use sandbox::{ - MAX_READ_BYTES, inside_root, inside_roots, read_text, resolve_in_root, resolve_in_roots, resolve_new_in_root, - resolve_new_in_roots, resolve_real, resolve_writable_in_root, resolve_writable_in_roots, + 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; diff --git a/crates/ide-plugin/src/runtime.rs b/crates/ide-plugin/src/runtime.rs index 37d719b955..85fa84e105 100644 --- a/crates/ide-plugin/src/runtime.rs +++ b/crates/ide-plugin/src/runtime.rs @@ -66,7 +66,7 @@ use views_bindings::exports::openidea::plugin::view_provider as wit_view; use views_bindings::openidea::plugin::view_types as wit_vt; /// The API version of the world above, `major.minor` of [`host_api`]. -pub const API_VERSION: &str = "1.20"; +pub const API_VERSION: &str = "1.21"; const EPOCH_TICK: Duration = Duration::from_millis(10); pub(crate) const MAX_TEXT: usize = 1 << 20; /// The most text, and the most PNG bytes, `ui.read-clipboard` returns. @@ -161,6 +161,36 @@ pub trait HostApi: Send + Sync { cancel: &CancellationToken, timeout: Duration, ) -> Result; + /// Stops an active run started from one of this plugin's configurations (API 1.21). + fn stop_run( + &self, + _client: &str, + _id: &str, + _cancel: &CancellationToken, + _timeout: Duration, + ) -> Result<(), HostError> { + Err(HostError::NotFound("run configuration unavailable".into())) + } + /// Creates or updates a saved run configuration of one of this plugin's own types (API 1.21). + fn upsert_run_configuration( + &self, + _client: &str, + _draft: crate::RunConfigDraft, + _cancel: &CancellationToken, + _timeout: Duration, + ) -> Result { + Err(HostError::NotFound("run configuration unavailable".into())) + } + /// Opens the Run/Debug Configurations dialog, optionally selecting `config_id` (API 1.21). + fn open_edit_configurations( + &self, + _client: &str, + _config_id: Option, + _cancel: &CancellationToken, + _timeout: Duration, + ) -> Result<(), HostError> { + Err(HostError::NotFound("run configuration unavailable".into())) + } /// Opens/reuses a keyed terminal, retained across idle instance reclamation; `cwd` /// (API 1.18) is a directory relative to the window's project root. #[allow(clippy::too_many_arguments)] @@ -1002,6 +1032,10 @@ fn event_to_wit(e: WorkbenchEvent) -> wit_events::Event { kind: "websocket-ready".into(), data: serde_json::to_string(&value).expect("WebSocket ready event serializes"), }), + WorkbenchEvent::RunStarted(value) => wit_events::Event::Other(wit_types::Extension { + kind: "run-started".into(), + data: serde_json::to_string(&value).unwrap(), + }), WorkbenchEvent::RunExited(value) => wit_events::Event::Other(wit_types::Extension { kind: "run-exited".into(), data: serde_json::to_string(&value).unwrap(), diff --git a/crates/ide-plugin/src/types.rs b/crates/ide-plugin/src/types.rs index c5497bbe6f..26a7dd008f 100644 --- a/crates/ide-plugin/src/types.rs +++ b/crates/ide-plugin/src/types.rs @@ -156,6 +156,7 @@ pub enum EventKind { FileClosed, SettingsChanged, InputModeChanged, + RunStarted, RunExited, TerminalExited, ContentTabAction, @@ -177,12 +178,13 @@ pub enum EventKind { } impl EventKind { - pub const ALL: [Self; 20] = [ + pub const ALL: [Self; 21] = [ Self::DocumentChanged, Self::WebsocketReady, Self::FileClosed, Self::SettingsChanged, Self::InputModeChanged, + Self::RunStarted, Self::RunExited, Self::TerminalExited, Self::ContentTabAction, @@ -207,6 +209,7 @@ impl EventKind { Self::FileClosed => "file-closed", Self::SettingsChanged => "settings-changed", Self::InputModeChanged => "input-mode-changed", + Self::RunStarted => "run-started", Self::RunExited => "run-exited", Self::TerminalExited => "terminal-exited", Self::ContentTabAction => "content-tab-action", @@ -235,6 +238,7 @@ impl EventKind { match self { Self::ActionPerformed | Self::InputModeChanged => Some(ide_extension::Capability::InputEvents), Self::Scheduled + | Self::RunStarted | Self::RunExited | Self::TerminalExited | Self::ContentTabAction @@ -364,6 +368,7 @@ pub struct WebSocketBatch { pub enum WorkbenchEvent { DocumentChanged(DocumentChanged), WebsocketReady(WebsocketReady), + RunStarted(crate::RunStarted), RunExited(crate::RunExited), TerminalExited(crate::TerminalExited), ContentTabAction(crate::ContentTabAction), @@ -394,6 +399,7 @@ impl WorkbenchEvent { match self { Self::DocumentChanged(_) => EventKind::DocumentChanged, Self::WebsocketReady(_) => EventKind::WebsocketReady, + Self::RunStarted(_) => EventKind::RunStarted, Self::RunExited(_) => EventKind::RunExited, Self::TerminalExited(_) => EventKind::TerminalExited, Self::ContentTabAction(_) => EventKind::ContentTabAction, diff --git a/crates/ide-plugin/src/wit_host.rs b/crates/ide-plugin/src/wit_host.rs index 5776cbf485..4a9727da64 100644 --- a/crates/ide-plugin/src/wit_host.rs +++ b/crates/ide-plugin/src/wit_host.rs @@ -1641,6 +1641,11 @@ impl events::Host for StoreData { { return Ok(Err(to_wit(e))); } + if kind == EventKind::RunStarted + && let Err(e) = self.host.require_api(kind.name(), 21) + { + return Ok(Err(to_wit(e))); + } if kind == EventKind::ExtensionsChanged && let Err(e) = self.host.require_api(kind.name(), 5) { @@ -2899,6 +2904,84 @@ impl bindings::openidea::plugin::run::Host for StoreData { ) .map_err(to_wit)) } + + fn stop(&mut self, id: String) -> Fallible<()> { + if let Err(e) = self.require_window() { + return Ok(Err(e)); + } + if id.trim().is_empty() || id.len() > MAX_TITLE || id.contains('\0') { + return Ok(Err(wit::Error::Invalid("invalid run id".into()))); + } + Ok(self + .host + .stop_run(self.invocation.client.as_deref().unwrap(), &id, &self.cancel.token(), self.remaining()) + .map_err(to_wit)) + } + + fn upsert_configuration(&mut self, draft: bindings::openidea::plugin::run::RunConfigDraft) -> Fallible { + if let Err(e) = self.require_window() { + return Ok(Err(e)); + } + if draft.name.trim().is_empty() || draft.name.len() > MAX_TITLE || draft.name.contains('\0') { + return Ok(Err(wit::Error::Invalid("invalid configuration name".into()))); + } + if draft.type_id.trim().is_empty() || draft.type_id.len() > MAX_TITLE || draft.type_id.contains('\0') { + return Ok(Err(wit::Error::Invalid("invalid run configuration type id".into()))); + } + if draft.args.len() > MAX_ARGS || draft.args.iter().any(|a| a.len() > MAX_ARG_BYTES || a.contains('\0')) { + return Ok(Err(wit::Error::Invalid("invalid run arguments".into()))); + } + if draft.env.len() > 64 + || draft.env.iter().any(|(k, v)| k.is_empty() || k.contains('=') || k.contains('\0') || v.contains('\0')) + { + return Ok(Err(wit::Error::Invalid("invalid environment variable".into()))); + } + if draft.params.len() > 128 + || draft.params.iter().any(|(k, v)| k.trim().is_empty() || k.contains('\0') || v.contains('\0')) + { + return Ok(Err(wit::Error::Invalid("invalid configuration parameter".into()))); + } + let draft = crate::RunConfigDraft { + id: draft.id, + type_id: draft.type_id, + name: draft.name, + command: draft.command, + args: draft.args, + cwd: draft.cwd, + env: draft.env, + params: draft.params, + allow_parallel: draft.allow_parallel, + }; + Ok(self + .host + .upsert_run_configuration( + self.invocation.client.as_deref().unwrap(), + draft, + &self.cancel.token(), + self.remaining(), + ) + .map_err(to_wit)) + } + + fn open_edit_configurations(&mut self, config_id: Option) -> Fallible<()> { + if let Err(e) = self.require_window() { + return Ok(Err(e)); + } + if let Some(ref id) = config_id + && (id.trim().is_empty() || id.len() > MAX_TITLE || id.contains('\0')) + { + return Ok(Err(wit::Error::Invalid("invalid configuration id".into()))); + } + Ok(self + .host + .open_edit_configurations( + self.invocation.client.as_deref().unwrap(), + config_id, + &self.cancel.token(), + self.remaining(), + ) + .map_err(to_wit)) + } } pub(crate) mod run_configurations_bindings { wasmtime::component::bindgen!({ world: "configurations-provider", path: "../../wit" }); diff --git a/crates/ide-plugin/tests/api_compat.rs b/crates/ide-plugin/tests/api_compat.rs index 821ce99b40..10b3d5aa03 100644 --- a/crates/ide-plugin/tests/api_compat.rs +++ b/crates/ide-plugin/tests/api_compat.rs @@ -98,7 +98,7 @@ fn the_sdk_carries_the_hosts_wit() { #[test] fn the_version_check_runs_compatible_components_and_explains_the_rest() { - let host = v("1.20.0"); + let host = v("1.21.0"); for ok in [ "1.0.0", "1.3.0", @@ -119,15 +119,16 @@ fn the_version_check_runs_compatible_components_and_explains_the_rest() { "1.18.0", "1.19.0", "1.20.0", + "1.21.0", "1.0.0-rc.1", ] { assert_eq!(check_api(&v(ok), &host), Ok(()), "{ok}"); } - let newer = check_api(&v("1.21.0"), &host).unwrap_err(); - assert!(newer.contains("1.21") && newer.contains("update OpenIDEA"), "{newer}"); + let newer = check_api(&v("1.22.0"), &host).unwrap_err(); + assert!(newer.contains("1.22") && newer.contains("update OpenIDEA"), "{newer}"); assert!(check_api(&v("2.0.0"), &host).unwrap_err().contains("update OpenIDEA")); let older = check_api(&v("0.2.0"), &host).unwrap_err(); - assert!(older.contains("rebuild it with the 1.20 SDK"), "{older}"); + assert!(older.contains("rebuild it with the 1.21 SDK"), "{older}"); // 0.x: every minor is its own API. assert_eq!(check_api(&v("0.2.0"), &v("0.2.5")), Ok(())); assert!(check_api(&v("0.1.0"), &v("0.2.0")).is_err()); diff --git a/crates/ide-plugin/tests/fixtures/api14/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/api14/dist/plugin.wasm index 52965f7399..7431b10265 100644 Binary files a/crates/ide-plugin/tests/fixtures/api14/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/api14/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/api14/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/api14/dist/plugin.wasm.sources index 3cb9bc4a0a..2860352c4b 100644 --- a/crates/ide-plugin/tests/fixtures/api14/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/api14/dist/plugin.wasm.sources @@ -1 +1 @@ -fbb81178d7ee654ba2ba009253643bb3e13865c6f41b946ad39508145c481df0 +5e1b98e6beb51fdacc358ac9a16eece3d696bc5f3cb17f8278b060c8d186d425 diff --git a/crates/ide-plugin/tests/fixtures/build-graph/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/build-graph/dist/plugin.wasm index b8d946edb4..b2a3eb6c28 100644 Binary files a/crates/ide-plugin/tests/fixtures/build-graph/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/build-graph/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/build-graph/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/build-graph/dist/plugin.wasm.sources index 7da9e15af9..ce4d4609c2 100644 --- a/crates/ide-plugin/tests/fixtures/build-graph/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/build-graph/dist/plugin.wasm.sources @@ -1 +1 @@ -3a246151d713185ea416f72e1c4dacb6d46b0c68a48b878f131c517051e5823d +27cd36ae025d3b93a179c9957f770a5a00746239e34964fd95cacd9fa12796e0 diff --git a/crates/ide-plugin/tests/fixtures/clipboard/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/clipboard/dist/plugin.wasm index 80a9c594a4..84ee066133 100644 Binary files a/crates/ide-plugin/tests/fixtures/clipboard/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/clipboard/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/clipboard/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/clipboard/dist/plugin.wasm.sources index 040d5b3cc1..ba589229be 100644 --- a/crates/ide-plugin/tests/fixtures/clipboard/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/clipboard/dist/plugin.wasm.sources @@ -1 +1 @@ -c71fba2e8fc92e0c30b88b79e91a62e829d0e4651a4cee43fb91af6388f27688 +ba8adc3daa979ef7d7cae161537ebc9726ee640d5a0c4fb3201a472c6804e00d diff --git a/crates/ide-plugin/tests/fixtures/commit/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/commit/dist/plugin.wasm index 4396475532..849461dcb0 100644 Binary files a/crates/ide-plugin/tests/fixtures/commit/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/commit/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/commit/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/commit/dist/plugin.wasm.sources index 7dd0471561..f1e6f11bf7 100644 --- a/crates/ide-plugin/tests/fixtures/commit/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/commit/dist/plugin.wasm.sources @@ -1 +1 @@ -c38fe66dd5601e29539cc002ea15ec9a33f70d0df129b6d3d2cb0da95358d632 +cdca6f0307b4c29829979ccfaafdcd818e5230e3435bc46a43a05790975f4c06 diff --git a/crates/ide-plugin/tests/fixtures/completion-list/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/completion-list/dist/plugin.wasm index 81ceeaa3d6..039b7aeb7c 100644 Binary files a/crates/ide-plugin/tests/fixtures/completion-list/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/completion-list/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/completion-list/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/completion-list/dist/plugin.wasm.sources index 31ec6ff432..138831582c 100644 --- a/crates/ide-plugin/tests/fixtures/completion-list/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/completion-list/dist/plugin.wasm.sources @@ -1 +1 @@ -c3fb87d8e3782fbe37dbdae67fefbaca9e11e97b9b34d92cc575e8f6dfcbe566 +01f27475af238667dce111d6a21d88456eaff48652326b9eb3094d9c7e0a1504 diff --git a/crates/ide-plugin/tests/fixtures/data-tools/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/data-tools/dist/plugin.wasm index 704f65ca28..89b62db6a7 100644 Binary files a/crates/ide-plugin/tests/fixtures/data-tools/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/data-tools/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/data-tools/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/data-tools/dist/plugin.wasm.sources index 8fd4910d3c..fc0b03b57e 100644 --- a/crates/ide-plugin/tests/fixtures/data-tools/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/data-tools/dist/plugin.wasm.sources @@ -1 +1 @@ -40f458ad646b1ecb4f68dcd190fcb6b979a07bbffcb63a136ba66eaa8bb90522 +67b3228c72a6c1170ba62b188cef4053f2a45b3bd4cfced1ad6f59b00e278c5a diff --git a/crates/ide-plugin/tests/fixtures/decorations/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/decorations/dist/plugin.wasm index 9ca253d1ee..adaf33997d 100644 Binary files a/crates/ide-plugin/tests/fixtures/decorations/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/decorations/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/decorations/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/decorations/dist/plugin.wasm.sources index 7cdb8f7c37..33bc62e07f 100644 --- a/crates/ide-plugin/tests/fixtures/decorations/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/decorations/dist/plugin.wasm.sources @@ -1 +1 @@ -f72b332f4288f992ba0ad4d7732f2c52e9eb168222cd0b405afcc593946890d1 +cccf85d92a5feb9b4f116166ac889c25cc3969678473e8d832cff0eeb9620402 diff --git a/crates/ide-plugin/tests/fixtures/detail-views/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/detail-views/dist/plugin.wasm index 58bc8a173d..908a0a802b 100644 Binary files a/crates/ide-plugin/tests/fixtures/detail-views/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/detail-views/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/detail-views/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/detail-views/dist/plugin.wasm.sources index 8dba62dfa6..b7f60fe77f 100644 --- a/crates/ide-plugin/tests/fixtures/detail-views/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/detail-views/dist/plugin.wasm.sources @@ -1 +1 @@ -74c63125ea431acea5f43e49c490c8810af342f476cffbe29f5fe567db4dbc30 +40a6302b80c7dfbcf8f8e5906184de0765d91e47dd4f3410e81ad0f087591534 diff --git a/crates/ide-plugin/tests/fixtures/diagnostics/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/diagnostics/dist/plugin.wasm index 10f216bc73..854b39ad07 100644 Binary files a/crates/ide-plugin/tests/fixtures/diagnostics/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/diagnostics/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/diagnostics/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/diagnostics/dist/plugin.wasm.sources index f98a0fffc1..03d87fafd4 100644 --- a/crates/ide-plugin/tests/fixtures/diagnostics/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/diagnostics/dist/plugin.wasm.sources @@ -1 +1 @@ -e09c6b3e642f2bae0c86551a89c89a73f41d366d47f4b29768e21eaa879d9260 +2b161461eb58c94a54bd21de9718a716475a61d5a91d4f960fe501d769343033 diff --git a/crates/ide-plugin/tests/fixtures/endpoints/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/endpoints/dist/plugin.wasm index 38030f5316..a777b85aca 100644 Binary files a/crates/ide-plugin/tests/fixtures/endpoints/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/endpoints/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/endpoints/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/endpoints/dist/plugin.wasm.sources index b37c0745ed..e0ede4e4a2 100644 --- a/crates/ide-plugin/tests/fixtures/endpoints/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/endpoints/dist/plugin.wasm.sources @@ -1 +1 @@ -a77a9acf6b4003c24d2ef55f63d33f488eb7ae1205fb143b3fc57d723cec55bc +ce643e66bd66b48c889a1676f56b964a0682493e2087c83fead51fb2c3a2265b diff --git a/crates/ide-plugin/tests/fixtures/execution-output/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/execution-output/dist/plugin.wasm index e835640b23..112bd47021 100644 Binary files a/crates/ide-plugin/tests/fixtures/execution-output/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/execution-output/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/execution-output/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/execution-output/dist/plugin.wasm.sources index 7ed5a1a23d..16afe0b65b 100644 --- a/crates/ide-plugin/tests/fixtures/execution-output/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/execution-output/dist/plugin.wasm.sources @@ -1 +1 @@ -82fdbc642d28863ca61f602b7df5c25b5553e70c9d90280d96b5ee71e9447400 +4b63b56f0d43b03bf3f762818585baa566e2164acb0112d26e4576adc5a88ee3 diff --git a/crates/ide-plugin/tests/fixtures/execution/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/execution/dist/plugin.wasm index 48550f04d3..0fb94a81ed 100644 Binary files a/crates/ide-plugin/tests/fixtures/execution/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/execution/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/execution/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/execution/dist/plugin.wasm.sources index 56262d93c5..cecfc63196 100644 --- a/crates/ide-plugin/tests/fixtures/execution/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/execution/dist/plugin.wasm.sources @@ -1 +1 @@ -eb250aaf92ff5f7efca010dfc9a2d3aee62b698390330bbbc75a2f10b9328989 +85290a12beeaa7114a278c25cc9e888ad4098cabf17b8749e068e6ae5fa2bfc6 diff --git a/crates/ide-plugin/tests/fixtures/ext-owner/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/ext-owner/dist/plugin.wasm index 4ae27bd69f..940622b5ed 100644 Binary files a/crates/ide-plugin/tests/fixtures/ext-owner/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/ext-owner/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/ext-owner/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/ext-owner/dist/plugin.wasm.sources index 4b9e92cae7..3ad3fb1009 100644 --- a/crates/ide-plugin/tests/fixtures/ext-owner/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/ext-owner/dist/plugin.wasm.sources @@ -1 +1 @@ -24ffd29881199bb7eede7084a4a11d14e70ee78e53261e2bd33d173112c98fd3 +d057138fa90fdca49af5658515a8feb674ddaca0f31330d54ae6d9b3bd15b414 diff --git a/crates/ide-plugin/tests/fixtures/file-templates/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/file-templates/dist/plugin.wasm index 648ee91ac9..59627b28e5 100644 Binary files a/crates/ide-plugin/tests/fixtures/file-templates/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/file-templates/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/file-templates/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/file-templates/dist/plugin.wasm.sources index 367f4cb608..4cd4a7cfdc 100644 --- a/crates/ide-plugin/tests/fixtures/file-templates/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/file-templates/dist/plugin.wasm.sources @@ -1 +1 @@ -740183f685319af40013c81a26da70df23e9a9fbe9293c24605c55b1cf6a9f55 +7751a98efbfca99c6be8fa1f75863be07196aeab0ca362e2a5c5c93738530dd2 diff --git a/crates/ide-plugin/tests/fixtures/files-events/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/files-events/dist/plugin.wasm index 38016774de..0df48b33c6 100644 Binary files a/crates/ide-plugin/tests/fixtures/files-events/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/files-events/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/files-events/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/files-events/dist/plugin.wasm.sources index afbf7d705d..5de1ce413d 100644 --- a/crates/ide-plugin/tests/fixtures/files-events/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/files-events/dist/plugin.wasm.sources @@ -1 +1 @@ -ba325d0dab1366018feef26a7bd5a8f2002f946972e725c1df10f2ffb7a0ab8e +a57186830e59d8c3a17867f9d1c1f583d5de7aeb787ea06a88be7544b2d62ce5 diff --git a/crates/ide-plugin/tests/fixtures/grouped-views/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/grouped-views/dist/plugin.wasm index 7e6c9b9b2f..32933f3ec2 100644 Binary files a/crates/ide-plugin/tests/fixtures/grouped-views/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/grouped-views/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/grouped-views/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/grouped-views/dist/plugin.wasm.sources index 951825f550..2d7e15ec4f 100644 --- a/crates/ide-plugin/tests/fixtures/grouped-views/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/grouped-views/dist/plugin.wasm.sources @@ -1 +1 @@ -3b1f0a3a43f0e0a6f17dd0d648ce69cf0619f052a981958656b1065c4923b4ec +a6872f8d50dcb5e5915ead3fcd37ca5fa3aa6f4c1fed76feba0997e2e73b70ab diff --git a/crates/ide-plugin/tests/fixtures/hello/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/hello/dist/plugin.wasm index dbe2f6c84c..64553e546b 100644 Binary files a/crates/ide-plugin/tests/fixtures/hello/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/hello/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/hello/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/hello/dist/plugin.wasm.sources index 77f7ff7b3c..2fb7f54dad 100644 --- a/crates/ide-plugin/tests/fixtures/hello/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/hello/dist/plugin.wasm.sources @@ -1 +1 @@ -d9e930f460de8bb20f5b228e5e15191b0a27c1247d564e5595b976f5453050ea +b23f34bc00919244a4a6a3bdb5438f50c94704143c9fcc8e7462e2b7d3a92db3 diff --git a/crates/ide-plugin/tests/fixtures/hover-actions/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/hover-actions/dist/plugin.wasm index e0db29c402..bbc64862ab 100644 Binary files a/crates/ide-plugin/tests/fixtures/hover-actions/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/hover-actions/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/hover-actions/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/hover-actions/dist/plugin.wasm.sources index 3a040e1703..7f3d362a96 100644 --- a/crates/ide-plugin/tests/fixtures/hover-actions/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/hover-actions/dist/plugin.wasm.sources @@ -1 +1 @@ -fd510b30360542de87a80052f373ad9b98faa68bc8c267bf1845d44d21e0fde7 +7c9a41e4f23fa994c288bd99357bb6f5ef0388c45458c86c973c1b341b90b4a0 diff --git a/crates/ide-plugin/tests/fixtures/hover/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/hover/dist/plugin.wasm index 49dd5a24ca..6226b4f032 100644 Binary files a/crates/ide-plugin/tests/fixtures/hover/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/hover/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/hover/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/hover/dist/plugin.wasm.sources index 4c09423b1d..6fe54db751 100644 --- a/crates/ide-plugin/tests/fixtures/hover/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/hover/dist/plugin.wasm.sources @@ -1 +1 @@ -c646af70d26715a3c231c80e16d93e40b8a2570516322c364924854be08af1d7 +b8342aeaea7dd0ab19cce6dff845b5771a5cb880f081f612f80372e3e2c0467c diff --git a/crates/ide-plugin/tests/fixtures/indexer/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/indexer/dist/plugin.wasm index 46fbca1f14..b0712a6e63 100644 Binary files a/crates/ide-plugin/tests/fixtures/indexer/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/indexer/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/indexer/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/indexer/dist/plugin.wasm.sources index abdba270d7..2bf3d7fb15 100644 --- a/crates/ide-plugin/tests/fixtures/indexer/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/indexer/dist/plugin.wasm.sources @@ -1 +1 @@ -1f64dbc8b9f1d623080eda6b19fccc161f35c9801e5c1689abb2a8e993f4856e +a3ff38ef3f229564c96fe4857bb872c5afb2e75c36eaf349aa85308bdb9a65f8 diff --git a/crates/ide-plugin/tests/fixtures/inlay-hints/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/inlay-hints/dist/plugin.wasm index fc94c5fe4b..5112569a51 100644 Binary files a/crates/ide-plugin/tests/fixtures/inlay-hints/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/inlay-hints/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/inlay-hints/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/inlay-hints/dist/plugin.wasm.sources index 60e2ebd753..9cc0758805 100644 --- a/crates/ide-plugin/tests/fixtures/inlay-hints/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/inlay-hints/dist/plugin.wasm.sources @@ -1 +1 @@ -71826d403bdaf5fee4390c0eb7a9fed7ee6804742b4c23ea8607e4897d6f5cce +166391164173750184924f130ec2b70adc8ea9a957169076104b652178223d3b diff --git a/crates/ide-plugin/tests/fixtures/jobs/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/jobs/dist/plugin.wasm index e2751530f8..e7773a7eac 100644 Binary files a/crates/ide-plugin/tests/fixtures/jobs/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/jobs/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/jobs/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/jobs/dist/plugin.wasm.sources index a0decb60cf..c86d9bc220 100644 --- a/crates/ide-plugin/tests/fixtures/jobs/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/jobs/dist/plugin.wasm.sources @@ -1 +1 @@ -418b35d6a7e98fe80d9594af073b409cf400ab8b65a7d2f42b524edceb284de4 +cb276ac498e1d75b87f77e6f9e9ea1fc640f97ff176463f2c6d9fbabafbe22fc diff --git a/crates/ide-plugin/tests/fixtures/language-features/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/language-features/dist/plugin.wasm index 9d6ac4b7dd..e4df3bf63e 100644 Binary files a/crates/ide-plugin/tests/fixtures/language-features/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/language-features/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/language-features/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/language-features/dist/plugin.wasm.sources index a6eb7499d7..a25dd187f8 100644 --- a/crates/ide-plugin/tests/fixtures/language-features/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/language-features/dist/plugin.wasm.sources @@ -1 +1 @@ -185a50ea6cd0564cb73ee66cd700b0dc052a1eab0c4418bfc515de83c7f88c55 +4505efe4856656ae46462d51e10b089afed337edd58d375c7e78645ca440d356 diff --git a/crates/ide-plugin/tests/fixtures/lsp-requests/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/lsp-requests/dist/plugin.wasm index 7213000b76..5a0a9bb1a3 100644 Binary files a/crates/ide-plugin/tests/fixtures/lsp-requests/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/lsp-requests/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/lsp-requests/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/lsp-requests/dist/plugin.wasm.sources index 3932ec9fff..017ee39ba1 100644 --- a/crates/ide-plugin/tests/fixtures/lsp-requests/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/lsp-requests/dist/plugin.wasm.sources @@ -1 +1 @@ -9024a4e059a4a5b5fa0c92bd235671914db911971f66d1189c34845c08c905e0 +ad33d221f82ded6638f11f99916987df52159f34ff7fbfc0e42962e98c19fe7b diff --git a/crates/ide-plugin/tests/fixtures/misbehave/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/misbehave/dist/plugin.wasm index ee24ef2a46..3f3beabf47 100644 Binary files a/crates/ide-plugin/tests/fixtures/misbehave/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/misbehave/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/misbehave/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/misbehave/dist/plugin.wasm.sources index ad982e2e9d..05d929edc6 100644 --- a/crates/ide-plugin/tests/fixtures/misbehave/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/misbehave/dist/plugin.wasm.sources @@ -1 +1 @@ -20f7450b91e444e74354bf87c1e7fdddaccdd500e6a2c315d622bcff45086066 +07cd3eca9e69a715b8dfc673d1afc7b349d55308a9f2a74420473a61724ecb11 diff --git a/crates/ide-plugin/tests/fixtures/misbehave/src/lib.rs b/crates/ide-plugin/tests/fixtures/misbehave/src/lib.rs index 7f367b56af..8a55060baa 100644 --- a/crates/ide-plugin/tests/fixtures/misbehave/src/lib.rs +++ b/crates/ide-plugin/tests/fixtures/misbehave/src/lib.rs @@ -5,10 +5,10 @@ wit_bindgen::generate!({ inline: " package fixture:misbehave; world misbehave { - include openidea:plugin/plugin-syntax@1.20.0; - export openidea:plugin/providers@1.20.0; - export openidea:plugin/file-actions@1.20.0; - export openidea:plugin/syntax-decorations-provider@1.20.0; + include openidea:plugin/plugin-syntax@1.21.0; + export openidea:plugin/providers@1.21.0; + export openidea:plugin/file-actions@1.21.0; + export openidea:plugin/syntax-decorations-provider@1.21.0; } ", path: "../../../../../wit", diff --git a/crates/ide-plugin/tests/fixtures/net-setting/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/net-setting/dist/plugin.wasm index 250d1051b2..3d6344edab 100644 Binary files a/crates/ide-plugin/tests/fixtures/net-setting/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/net-setting/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/net-setting/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/net-setting/dist/plugin.wasm.sources index 25a3ba7a6e..205661de39 100644 --- a/crates/ide-plugin/tests/fixtures/net-setting/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/net-setting/dist/plugin.wasm.sources @@ -1 +1 @@ -800d5114110774f24ddd30cf4b4b14a802dc9f41cdc5e8834a4a429adc186ed3 +381947871c93014b874637df7d9e4c43ffc7cda1fa6f07529537ef668c5dcef2 diff --git a/crates/ide-plugin/tests/fixtures/path-events/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/path-events/dist/plugin.wasm index 49353c8ec1..3cbbe25446 100644 Binary files a/crates/ide-plugin/tests/fixtures/path-events/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/path-events/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/path-events/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/path-events/dist/plugin.wasm.sources index f4fd568240..f90fa934e7 100644 --- a/crates/ide-plugin/tests/fixtures/path-events/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/path-events/dist/plugin.wasm.sources @@ -1 +1 @@ -aab5a3b60e1f0dfc3474994f8d61b571b1a15b5070ee753d75234fac300843bc +b8f44941ea1f94f46061bf5f56a68a61e588fd329d70be34b42fd1aa9e980726 diff --git a/crates/ide-plugin/tests/fixtures/private-dir/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/private-dir/dist/plugin.wasm index 6a504d0c99..16b5248442 100644 Binary files a/crates/ide-plugin/tests/fixtures/private-dir/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/private-dir/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/private-dir/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/private-dir/dist/plugin.wasm.sources index 0f2b191ded..00490ba16b 100644 --- a/crates/ide-plugin/tests/fixtures/private-dir/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/private-dir/dist/plugin.wasm.sources @@ -1 +1 @@ -3e6345dee4360f925168f1a9dca30e9464054937252aa075368d5b3fed237c62 +f70e1408d3013bb59317374e11a11a867b34517e2eedda800bc12548e8623655 diff --git a/crates/ide-plugin/tests/fixtures/run-anything/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/run-anything/dist/plugin.wasm index a15305cb7e..8f088561ce 100644 Binary files a/crates/ide-plugin/tests/fixtures/run-anything/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/run-anything/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/run-anything/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/run-anything/dist/plugin.wasm.sources index f032744609..f11330cfc0 100644 --- a/crates/ide-plugin/tests/fixtures/run-anything/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/run-anything/dist/plugin.wasm.sources @@ -1 +1 @@ -97d5c95eff3e2d5837f7ff07f7f4c82dfbbdec3522b8294d0a865e70ae020d14 +9ac7b763f03e03f472ff08f683a98d76caa1fbd3b49d449873ca207269ee659d diff --git a/crates/ide-plugin/tests/fixtures/search/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/search/dist/plugin.wasm index 41d5f5355d..3f63cb0a82 100644 Binary files a/crates/ide-plugin/tests/fixtures/search/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/search/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/search/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/search/dist/plugin.wasm.sources index 1d60dd388b..bb1eb6756b 100644 --- a/crates/ide-plugin/tests/fixtures/search/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/search/dist/plugin.wasm.sources @@ -1 +1 @@ -fd34c1b1d1a131122822a102d9168b1c700b5f26c1a336a2bda0ae07b1d83314 +e7588bb30941795431305e5f678348a2d2349c7bf66e19e8df1c169855f4329f diff --git a/crates/ide-plugin/tests/fixtures/semantic-tokens/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/semantic-tokens/dist/plugin.wasm index 1b1c9e285b..841e023e80 100644 Binary files a/crates/ide-plugin/tests/fixtures/semantic-tokens/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/semantic-tokens/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/semantic-tokens/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/semantic-tokens/dist/plugin.wasm.sources index 19936245eb..90bc16ee98 100644 --- a/crates/ide-plugin/tests/fixtures/semantic-tokens/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/semantic-tokens/dist/plugin.wasm.sources @@ -1 +1 @@ -20d01f5aa6f3519f40138a674500d5485a87bd2ba83e91b584e7e7592801fe86 +a832705b29530f10d25167d25280f0555d63ad130daa63aa46d3f64109354273 diff --git a/crates/ide-plugin/tests/fixtures/settings-pages/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/settings-pages/dist/plugin.wasm index 138600a39d..4abd42f79e 100644 Binary files a/crates/ide-plugin/tests/fixtures/settings-pages/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/settings-pages/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/settings-pages/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/settings-pages/dist/plugin.wasm.sources index 0ca312fda5..0bd6dfa743 100644 --- a/crates/ide-plugin/tests/fixtures/settings-pages/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/settings-pages/dist/plugin.wasm.sources @@ -1 +1 @@ -da1cabc8d502e54bc4dbcaa92a8b8d570d696b842dba174f3e0011db896d9083 +f0af669dae3115839b8ff04e1c54ab008691341e1394b5221f4554cb0c416b6f diff --git a/crates/ide-plugin/tests/fixtures/storage/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/storage/dist/plugin.wasm index 7508e7a1f9..053100777b 100644 Binary files a/crates/ide-plugin/tests/fixtures/storage/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/storage/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/storage/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/storage/dist/plugin.wasm.sources index 43b75c92e9..f2eb3fdb7b 100644 --- a/crates/ide-plugin/tests/fixtures/storage/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/storage/dist/plugin.wasm.sources @@ -1 +1 @@ -911a05d11ca6e419fd7adee7a21fa76cb669a2d32242c281f59eb6366a55810d +225f929842a16a34268788f1287ee725c0fa777ba45a9af910b757bfb32092b0 diff --git a/crates/ide-plugin/tests/fixtures/symbols/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/symbols/dist/plugin.wasm index 8ab8c1a206..57fce26305 100644 Binary files a/crates/ide-plugin/tests/fixtures/symbols/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/symbols/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/symbols/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/symbols/dist/plugin.wasm.sources index 5d9b48195c..687f45517f 100644 --- a/crates/ide-plugin/tests/fixtures/symbols/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/symbols/dist/plugin.wasm.sources @@ -1 +1 @@ -039e8c3424f0417b1cd8cd46b2d2e2938971304983b61e9bc5e8ce4955ab96cd +acfc88e278837cde7175b443c3f37a51317831ce12415763dc38c75fafcff577 diff --git a/crates/ide-plugin/tests/fixtures/syntax-decorations/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/syntax-decorations/dist/plugin.wasm index 6b7117474d..f81b272e89 100644 Binary files a/crates/ide-plugin/tests/fixtures/syntax-decorations/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/syntax-decorations/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/syntax-decorations/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/syntax-decorations/dist/plugin.wasm.sources index 1fd1e7dba6..256a2f73e1 100644 --- a/crates/ide-plugin/tests/fixtures/syntax-decorations/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/syntax-decorations/dist/plugin.wasm.sources @@ -1 +1 @@ -7bc77abc900cd575e24e2fda4a27aac752b82df45811671aeaef3736dafa2808 +67f398a57d565be17f521e3f4100a99606555e57cc008e0f8e4ee6b7b96fce7f diff --git a/crates/ide-plugin/tests/fixtures/tables/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/tables/dist/plugin.wasm index 19c689a7ec..a7cdd7f55e 100644 Binary files a/crates/ide-plugin/tests/fixtures/tables/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/tables/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/tables/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/tables/dist/plugin.wasm.sources index 549ee7ed09..bc0c60f906 100644 --- a/crates/ide-plugin/tests/fixtures/tables/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/tables/dist/plugin.wasm.sources @@ -1 +1 @@ -d1f97800b9aad4b6c27d2a2e1e47dfa1ca70741b9a4163940d36547a2a2d5af1 +46f8d086f1e384c7984db3ce3a2df58595b4ab513b6ae62181c64a5f075f40a4 diff --git a/crates/ide-plugin/tests/fixtures/watch-paths/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/watch-paths/dist/plugin.wasm index 1ff53e3890..bd121def98 100644 Binary files a/crates/ide-plugin/tests/fixtures/watch-paths/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/watch-paths/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/watch-paths/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/watch-paths/dist/plugin.wasm.sources index c94219830b..7393886ca5 100644 --- a/crates/ide-plugin/tests/fixtures/watch-paths/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/watch-paths/dist/plugin.wasm.sources @@ -1 +1 @@ -671ed8fe2f6a922fd92ee3ca2a6c2e47ffcf0985fb9e4f96c5ec7712d3c728e6 +3cf9a0a6983597598d36dd7be7c4f618827738d8b0946e94d7a6983bd22e9c0c diff --git a/crates/ide-plugin/tests/fixtures/web-content/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/web-content/dist/plugin.wasm index 3c5d4f47a7..70c954d3c5 100644 Binary files a/crates/ide-plugin/tests/fixtures/web-content/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/web-content/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/web-content/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/web-content/dist/plugin.wasm.sources index 189e197b48..832339ebdf 100644 --- a/crates/ide-plugin/tests/fixtures/web-content/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/web-content/dist/plugin.wasm.sources @@ -1 +1 @@ -5cd36ce9a7e01aafadd4b14fab1367664a7a5ffa0f7332d8b3b22770bb381422 +7409ab4737467131056c631e81b8a5aa0f7698ae67935870572cba163770719b diff --git a/crates/ide-plugin/tests/fixtures/web-log/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/web-log/dist/plugin.wasm index 177463ff4a..9d1c768d5b 100644 Binary files a/crates/ide-plugin/tests/fixtures/web-log/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/web-log/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/web-log/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/web-log/dist/plugin.wasm.sources index cb2354a49f..321fefbd4f 100644 --- a/crates/ide-plugin/tests/fixtures/web-log/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/web-log/dist/plugin.wasm.sources @@ -1 +1 @@ -da9ee39b1b46ab778b0bf6b5d3719d5d0ef5500778be75ff54ca276b31310ac2 +52cda09f68c3368b0b123435d5c9e52a8f74f1118c717a7664ba77504a64d781 diff --git a/crates/ide-plugin/tests/fixtures/web-pty/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/web-pty/dist/plugin.wasm index 3b346dd7b0..83232b697e 100644 Binary files a/crates/ide-plugin/tests/fixtures/web-pty/dist/plugin.wasm and b/crates/ide-plugin/tests/fixtures/web-pty/dist/plugin.wasm differ diff --git a/crates/ide-plugin/tests/fixtures/web-pty/dist/plugin.wasm.sources b/crates/ide-plugin/tests/fixtures/web-pty/dist/plugin.wasm.sources index 8a0113c3aa..679fbdb006 100644 --- a/crates/ide-plugin/tests/fixtures/web-pty/dist/plugin.wasm.sources +++ b/crates/ide-plugin/tests/fixtures/web-pty/dist/plugin.wasm.sources @@ -1 +1 @@ -f81c21c6cfe046bf2149f53bee39aeb45b320593996e163f4e5ea3acfebdfa78 +529a1b6e1a3c06dadd09a143f36650cc697bfb26a0dd53ad958e1ebcafbbc1a5 diff --git a/docs/en/plugins/guides/commands.mdx b/docs/en/plugins/guides/commands.mdx index 2f869c70c7..2c63849f5f 100644 --- a/docs/en/plugins/guides/commands.mdx +++ b/docs/en/plugins/guides/commands.mdx @@ -174,6 +174,7 @@ when = "editorLangId == markdown" # optional | `services.context` | Right-click menu of the IDE's own Services nodes (run configurations, Docker) | 1.18 | | `services.toolbar` | Services toolbar, for the selected IDE-owned nodes | 1.18 | | `openIn` | **Open In** submenu of the editor, editor tab and Project view menus | 1.19 | +| `runConsole.toolbar` | Toolbar of the Run and Debug consoles | 1.21 | Using a menu newer than 1.0 means declaring at least that API in `engines.openidea`. Every entry names a command the plugin declares. The menu's `when` applies alongside the diff --git a/docs/en/plugins/manifest.mdx b/docs/en/plugins/manifest.mdx index 904f7b7196..5356f04fec 100644 --- a/docs/en/plugins/manifest.mdx +++ b/docs/en/plugins/manifest.mdx @@ -121,7 +121,7 @@ Each contribution point is a table (`[contributes.settings]`) or an array of tab | `overlays` | `id`, `web`, `width`, `height`, `anchor?`, `when?`, `interactive?` (API 1.18) | no | [README: Overlays](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#overlays) | | `runAnything` | `prefix`, `title?` (API 1.18) | no | [README: Run Anything entries](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#run-anything-entries-api-118) | | `dialogs` | `id`, `title`, `web`, `width`, `height` (API 1.18) | no | [README: Dialogs](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#dialogs) | -| `runConfigTypes` | `id`, `label`, `web`, `layout?`, `prepareCommand?`, `matchConfigPrefix?` (API 1.20; requires `process:` grants at Run/Debug/Stop) | no | [README: Custom run configuration forms](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#custom-run-configuration-forms) | +| `runConfigTypes` | `id`, `label`, `web`, `layout?`, `prepareCommand?`, `matchConfigPrefix?`, `ownsBeforeLaunch?` (API 1.20; `ownsBeforeLaunch`: 1.21) | no | [README: Custom run configuration forms](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#custom-run-configuration-forms) | | `fileIcons` | `id`, `patterns`, `icon`, `iconDark?` | no | [Icon themes](/en/plugins/guides/icon-themes) | | `fileTemplates` | `id`, `name`, `extension`, `path`; API 1.3: `fileName`, `variables` | no | [File actions](/en/plugins/guides/file-actions) | | `snippets` | `language`, `path` (API 1.4) | no | [Language features](/en/plugins/guides/language-features) | diff --git a/docs/en/plugins/versioning.mdx b/docs/en/plugins/versioning.mdx index 9e842b5114..b6d52a4376 100644 --- a/docs/en/plugins/versioning.mdx +++ b/docs/en/plugins/versioning.mdx @@ -1,9 +1,9 @@ --- title: "API versions and compatibility" -description: "engines.openidea, the plugin API versions from 1.0 to 1.20, and the rules that keep released plugins loading in newer IDEs." +description: "engines.openidea, the plugin API versions from 1.0 to 1.21, and the rules that keep released plugins loading in newer IDEs." --- -The plugin API has one version number: the version of the WIT package in [`wit/`](https://github.com/l0ng-ai/openidea/tree/main/wit) (`openidea:plugin@1.20.0` on `main`). The host's engine version and the SDK's `API_VERSION` always agree with it, and the SDK carries an identical copy of the WIT files. +The plugin API has one version number: the version of the WIT package in [`wit/`](https://github.com/l0ng-ai/openidea/tree/main/wit) (`openidea:plugin@1.21.0` on `main`). The host's engine version and the SDK's `API_VERSION` always agree with it, and the SDK carries an identical copy of the WIT files. The plugin system is a preview. The compatibility rules below hold for released 1.x versions; what is still unreleased @@ -35,6 +35,7 @@ The plugin API has one version number: the version of the WIT package in [`wit/` | 1.18.0 | OpenIDEA 0.1.54 | `[[contributes.overlays]]`: a package web page floating over the workbench that never takes the keyboard focus, placed and resized through `openidea.overlay`; `[[contributes.dialogs]]`: a package web page in a modal, resizable IDE dialog opened with `views.reveal`, with a `closed` view event and `openidea.dialog.close()`; `events.subscribe-paths-with-options` (`debounce-ms`), `workspace.project.generation` and `FilesChanged` project/generation fields, stale run target/configuration rejection, and the `project-closed` lifecycle event; `execution-configurations`, `run.start-with-options` and `runDetectors.outputMode`: `pipes` or `pty` console output for plugin run configurations; `[[contributes.runAnything]]` with the `run-anything-provider` export: Run Anything lines starting with the plugin's prefix; `views.open-terminal-session-in`: a keyed terminal in a project directory; `workspace.invoking-project`: the project of the window a call serves, also in `gutter-actions` and `hover-actions`; `events.watch-paths` and the `watched-files-changed` event: files and directories outside the project, within `fs.read` grants; the `run-configuration-completion` export: completion in the Arguments field of the plugin's own run configurations; `services.context` and `services.toolbar` menus on the IDE's own Services nodes, with the selected services as the command argument; `executor` on `[[contributes.javaAgents]]`: "Run/Debug '' with " beside Run and Debug, the only launches that get that agent, also startable from the plugin's own commands with a configuration id; grant-scoped `agents.fork-session`: fork a recorded native agent session (`claude`, `codex`, or `copilot`) into a new task in the invoking window's project (`agents` capability), with the host validating the session and building the fork invocation itself | | 1.19.0 | In development on `main` | `[capabilities.reasons]`: the plugin's own sentence on why it asks for a capability, shown below the host's description in the permission dialog and Settings › Plugins; `settings.open` / `settings.open-permissions`: open Settings at one of the plugin's own pages or at its permissions; `net.fetch-stream`: a response whose body is read as it arrives (server-sent events, streamed model replies), with the SDK's `host::fetch_stream` and `sse` parser; `editor.open-as-text`: open a file in the built-in text editor even when a custom editor claims it (the SDK's `host::open_editor_as_text`); the `openIn` menu: the **Open In** submenu of the editor, its tab and the Project view | | 1.20.0 | In development | Database table context menus and read-only table schema inspection (`database.schema`). Optional `syntax-decorations-provider` export: foreground marks on an open text editor, in the theme tokens `rainbow-1` … `rainbow-5` or its own `#rrggbb` colours for dark and light themes, and a bounded slice of the editor's syntax tree. | +| 1.21.0 | In development | Run lifecycle & Run Config extensions: `run-started` event, `run-exited` for user-launched plugin runs, `run.stop`, `"java"` in `attach-child`, `prepareCommand` `mode` (`"run"` / `"debug"`) and loopback `javaDebug` JDWP attach, `run.upsert-configuration`, `run.open-edit-configurations`, `ownsBeforeLaunch`, transient `logFiles` log-tail tabs (`project.read` / `fs.read`), and the `runConsole.toolbar` menu. | The full list of what each version added is in [`plugins/README.md`](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md). diff --git a/docs/zh/plugins/guides/commands.mdx b/docs/zh/plugins/guides/commands.mdx index ad0ada360f..40d20a672c 100644 --- a/docs/zh/plugins/guides/commands.mdx +++ b/docs/zh/plugins/guides/commands.mdx @@ -158,6 +158,7 @@ when = "editorLangId == markdown" # 可选 | `services.context` | IDE 自带 Services 节点(运行配置、Docker)的右键菜单 | 1.18 | | `services.toolbar` | 选中 IDE 自带节点时的 Services 工具栏 | 1.18 | | `openIn` | 编辑器、编辑器标签页和项目视图右键菜单里的 **打开方式** 子菜单 | 1.19 | +| `runConsole.toolbar` | Run 与 Debug 控制台的工具栏 | 1.21 | 使用 1.0 之后加入的菜单,需要在 `engines.openidea` 中至少声明对应的 API 版本。每个条目都必须指向插件声明过的命令。 菜单的 `when` 与命令自身的 `when` 同时生效。 diff --git a/docs/zh/plugins/manifest.mdx b/docs/zh/plugins/manifest.mdx index 99f81d1493..d19f4ab976 100644 --- a/docs/zh/plugins/manifest.mdx +++ b/docs/zh/plugins/manifest.mdx @@ -121,7 +121,7 @@ optional = ["net:api.openai.com", "secrets"] | `overlays` | `id`、`web`、`width`、`height`、`anchor?`、`when?`、`interactive?`(API 1.18) | 否 | [README:Overlays](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#overlays) | | `runAnything` | `prefix`、`title?`(API 1.18) | 否 | [README:Run Anything entries](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#run-anything-entries-api-118) | | `dialogs` | `id`、`title`、`web`、`width`、`height`(API 1.18) | 否 | [README:Dialogs](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#dialogs) | -| `runConfigTypes` | `id`、`label`、`web`、`layout?`、`prepareCommand?`、`matchConfigPrefix?`(API 1.20;Run/Debug/Stop 均需 `process:<program>` 授权) | 否 | [README:Custom run configuration forms](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#custom-run-configuration-forms) | +| `runConfigTypes` | `id`、`label`、`web`、`layout?`、`prepareCommand?`、`matchConfigPrefix?`、`ownsBeforeLaunch?`(API 1.20;`ownsBeforeLaunch` 为 1.21) | 否 | [README:Custom run configuration forms](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md#custom-run-configuration-forms) | | `fileIcons` | `id`、`patterns`、`icon`、`iconDark?` | 否 | [图标主题](/zh/plugins/guides/icon-themes) | | `fileTemplates` | `id`、`name`、`extension`、`path`;API 1.3:`fileName`、`variables` | 否 | [文件操作](/zh/plugins/guides/file-actions) | | `snippets` | `language`、`path`(API 1.4) | 否 | [语言功能](/zh/plugins/guides/language-features) | diff --git a/docs/zh/plugins/versioning.mdx b/docs/zh/plugins/versioning.mdx index 6c1d502703..0aa7ebdb51 100644 --- a/docs/zh/plugins/versioning.mdx +++ b/docs/zh/plugins/versioning.mdx @@ -1,9 +1,9 @@ --- title: "API 版本与兼容" -description: "engines.openidea、插件 API 从 1.0 到 1.20 的各个版本,以及让已发布插件在新 IDE 中继续加载的规则。" +description: "engines.openidea、插件 API 从 1.0 到 1.21 的各个版本,以及让已发布插件在新 IDE 中继续加载的规则。" --- -插件 API 只有一个版本号:[`wit/`](https://github.com/l0ng-ai/openidea/tree/main/wit) 中 WIT 包的版本(`main` 上是 `openidea:plugin@1.20.0`)。宿主的引擎版本和 SDK 的 `API_VERSION` 始终与它一致,SDK 里也带着一份完全相同的 WIT 文件。 +插件 API 只有一个版本号:[`wit/`](https://github.com/l0ng-ai/openidea/tree/main/wit) 中 WIT 包的版本(`main` 上是 `openidea:plugin@1.21.0`)。宿主的引擎版本和 SDK 的 `API_VERSION` 始终与它一致,SDK 里也带着一份完全相同的 WIT 文件。 <Note>插件系统目前是预览版。下面的兼容规则适用于已发布的 1.x 版本;`main` 上尚未发布的内容在发布前仍可能变化。</Note> @@ -32,6 +32,7 @@ description: "engines.openidea、插件 API 从 1.0 到 1.20 的各个版本, | 1.18.0 | OpenIDEA 0.1.54 | `[[contributes.overlays]]`:悬浮在工作台上方、从不抢占键盘焦点的插件网页,可通过 `openidea.overlay` 移动和调整大小;`[[contributes.dialogs]]`:插件网页显示在可调整大小的模态对话框中,用 `views.reveal` 打开,关闭时发 `closed` 视图事件,页面可调用 `openidea.dialog.close()`;`events.subscribe-paths-with-options`(`debounce-ms`)、`workspace.project.generation` 与 `FilesChanged` 的 `project`/`generation` 字段、过期运行目标/配置拒绝以及 `project-closed` 生命周期事件;`execution-configurations`、`run.start-with-options` 与 `runDetectors.outputMode`:插件运行配置的控制台输出方式(`pipes` 或 `pty`);`[[contributes.runAnything]]` 与 `run-anything-provider` 导出:以插件前缀开头的 Run Anything 行;`views.open-terminal-session-in`:在项目子目录中打开带 key 的终端;`workspace.invoking-project`:本次调用所服务窗口的项目,`gutter-actions` 和 `hover-actions` 中也可用;`events.watch-paths` 与 `watched-files-changed` 事件:监听项目之外、`fs.read` 授权范围内的文件和目录;`run-configuration-completion` 导出:补全插件自己运行配置的“实参”字段;`services.context` 和 `services.toolbar` 菜单:作用于 IDE 自带的 Services 节点,命令参数是选中的服务;`[[contributes.javaAgents]]` 的 `executor`:运行和调试旁边的“使用 <title> 运行/调试 '<name>'”,只有经它启动时才加载该代理,插件自己的命令也可用配置 id 经它启动;需授权的 `agents.fork-session`:把录制的原生 agent 会话(`claude`、`codex` 或 `copilot`)派生为调用窗口项目中的新任务(`agents` 能力),宿主自行校验会话并构造 fork 调用 | | 1.19.0 | `main` 上开发中 | `[capabilities.reasons]`:插件用一句话说明为什么需要某个能力,显示在授权对话框和 设置 › 插件 中宿主说明的下方;`settings.open` / `settings.open-permissions`:打开设置并定位到插件自己的页面或它的权限;`net.fetch-stream`:边到达边读取响应体(服务器推送事件 SSE、模型的流式回复),SDK 提供 `host::fetch_stream` 和 `sse` 解析器;`editor.open-as-text`:即使文件被自定义编辑器认领,也用内置文本编辑器打开(SDK 的 `host::open_editor_as_text`);菜单点 `openIn`:编辑器、标签页和项目视图的 **打开方式** 子菜单 | | 1.20.0 | `main` 上开发中 | 数据库表的上下文菜单和只读表结构查看(`database.schema`)。可选的 `syntax-decorations-provider` 导出:用主题 token `rainbow-1` … `rainbow-5` 或自带的深色/浅色主题 `#rrggbb` 颜色,给打开的文本编辑器中的范围涂前景色,依据编辑器语法树的有界片段。 | +| 1.21.0 | `main` 上开发中 | 运行配置与运行生命周期扩展:`run-started` 事件与用户启动配置时的 `run-exited`、`run.stop`、`attach-child` 支持 `"java"`、`prepareCommand` 传入 `mode`(`"run"` / `"debug"`)并支持回环 `javaDebug` 附加 JDWP 调试器、`run.upsert-configuration`、`run.open-edit-configurations`、`ownsBeforeLaunch`、控制台日志文件实时标签页 `logFiles`(按 `project.read` / `fs.read` 授权)以及 `runConsole.toolbar` 菜单位置。 | 每个版本新增内容的完整列表见 [`plugins/README.md`](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md)。 diff --git a/plugins/README.md b/plugins/README.md index bf194ac382..9f3523e7e4 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -36,7 +36,7 @@ sdk/rust/openidea-plugin/ # the Rust SDK (host API, Plugin trait, mock host) crates/ide-plugin/tests/fixtures/ # test plugins: hello, jobs, language-toy, misbehave, semantic-tokens, hover, commit, inlay-hints, decorations, syntax-decorations ``` -The plugin API is defined in [`wit/`](../wit/) (`openidea:plugin@1.20.0`, world +The plugin API is defined in [`wit/`](../wit/) (`openidea:plugin@1.21.0`, world `plugin`). ## 1. Quick start @@ -991,8 +991,11 @@ then run `openidea-plugin check`. | `host::open_terminal(title, program, args)` | `views.open-terminal` | A terminal tab in the invoking window running the approved `process:<program>` in the project root: output that keeps coming, interactive sessions. | | `host::register_run_target(project, target)` | `run-targets.register` | API 1.4: project-scoped, read-only argv wrapper; requires its process grant, executable pin and project trust; remote projects run on the server. | | `host::unregister_run_target(project, id)` | `run-targets.unregister` | Withdraw this plugin's target; remembered prompt answers remain. | -| `host::start_run(config, args, debug)` | `run.start` | API 1.4: start an owned configuration in this window's Run tool window; returns an id, followed by `run-exited`. Approved `process:` program; commands/events only. | +| `host::start_run(config, args, debug)` | `run.start` | API 1.4: start an owned configuration in this window's Run tool window; returns an id, followed by `run-started` (API 1.21) and `run-exited`. Approved `process:` program; commands/events only. | | `host::start_run_with_options(config, args, options)` | `run.start-with-options` | API 1.18: start an owned configuration with `RunStartOptions` (`debug` and optional per-launch `output_mode`); user-saved override wins over `options.output_mode`, which wins over plugin default. | +| `host::stop_run(id)` | `run.stop` | API 1.21: stop an active run started from one of this plugin's own configurations (by operation id or run id). | +| `host::upsert_run_configuration(draft)` | `run.upsert-configuration` | API 1.21: create or update a saved configuration of one of this plugin's own `[[contributes.runConfigTypes]]` in the invoking window; returns the saved configuration id. | +| `host::open_edit_configurations(config_id)` | `run.open-edit-configurations` | API 1.21: open the Run/Debug Configurations dialog in the invoking window, optionally selecting `config_id`. | | `host::open_terminal_session(key, title, cmd)` | `views.open-terminal-session` | API 1.4: keyed, pinned terminal in this window, append-only env; returns its operation id and later `terminal-exited`. | | `host::open_terminal_session_in(key, title, cmd, cwd)` | `views.open-terminal-session-in` | API 1.18: the same, started in `cwd`, a directory of the project relative to its root. | | `host::write_terminal(key, text)` | `views.write-terminal` | API 1.4: write only to this plugin's still-running terminal in this window; trusted project, commands/events only. | @@ -2762,7 +2765,8 @@ layout = "embedded" # "embedded" (default) or "full" (replaces everyth height = 360 # embedded height in pixels, 120–1200 ownsWorkingDirectory = false ownsEnvironment = false -prepareCommand = "prepare" # optional command invoked before Run/Debug; returns a JSON patch +ownsBeforeLaunch = false # hide built-in Before launch editor (API 1.21) +prepareCommand = "prepare" # optional command invoked before Run/Debug (`mode`); returns a JSON patch matchConfigPrefix = "" # optional id prefix for matching plugin:<id>:<config> entries ``` @@ -2770,7 +2774,10 @@ Inside the page, `openidea.runConfig` provides `get()`, `patch(patch)`, `setErrors(errors)`, `setHeight(height)`, and `onChange(fn)` to read and update the staged `RunConfig` draft (including `params`, `command`, `args`, `cwd`, `env`, `debugAdapter`, and `name`), surface validation errors that block OK/Apply/Run, -and resize embedded forms. +and resize embedded forms. In API 1.21, `prepareCommand` receives `mode` (`"run"` | +`"debug"`) and may also return transient `javaDebug` (`{ host?, port?, timeoutMs? }`, +loopback only, to attach JDWP) and `logFiles` (`[{ id?, title, path }]`, tailed in +Run console tabs when readable via `project.read` or `fs.read:<dir>`). **Process grants and host launch checks.** Every launch (Run, Debug, and any `stopCommand`) goes through host-owned plugin authorization: diff --git a/plugins/official/ai-completion/dist/plugin.wasm b/plugins/official/ai-completion/dist/plugin.wasm index 6f9810dfe8..dde0fb9d10 100644 Binary files a/plugins/official/ai-completion/dist/plugin.wasm and b/plugins/official/ai-completion/dist/plugin.wasm differ diff --git a/plugins/official/ai-completion/dist/plugin.wasm.sources b/plugins/official/ai-completion/dist/plugin.wasm.sources index 5cf00e7b4e..3c9a215576 100644 --- a/plugins/official/ai-completion/dist/plugin.wasm.sources +++ b/plugins/official/ai-completion/dist/plugin.wasm.sources @@ -1 +1 @@ -55181617e0c0df5d3d454bf9cc95323f406ef247df09b43a25e06fd539393754 +68d378fa7322f1ff12ff5654fdc8d371a33863110dd14067d7085f66e43f7807 diff --git a/plugins/official/blame-annotations/dist/plugin.wasm b/plugins/official/blame-annotations/dist/plugin.wasm index c13a506db1..e699ce0fa5 100644 Binary files a/plugins/official/blame-annotations/dist/plugin.wasm and b/plugins/official/blame-annotations/dist/plugin.wasm differ diff --git a/plugins/official/blame-annotations/dist/plugin.wasm.sources b/plugins/official/blame-annotations/dist/plugin.wasm.sources index 64eb28e673..5c737f84a9 100644 --- a/plugins/official/blame-annotations/dist/plugin.wasm.sources +++ b/plugins/official/blame-annotations/dist/plugin.wasm.sources @@ -1 +1 @@ -77fc141a21a9eecc7cf4eb6b4a5b88b79ef242f5e3eacbd150640e6f45038e3e +a2d9dd25d6ba47fca10d982064708341b53cfc9791d890c241efb38488cf5c65 diff --git a/plugins/official/checkstyle/dist/plugin.wasm b/plugins/official/checkstyle/dist/plugin.wasm index 1c85e249e3..31df3a48e3 100644 Binary files a/plugins/official/checkstyle/dist/plugin.wasm and b/plugins/official/checkstyle/dist/plugin.wasm differ diff --git a/plugins/official/checkstyle/dist/plugin.wasm.sources b/plugins/official/checkstyle/dist/plugin.wasm.sources index d6e2c5fd7b..1efc21c530 100644 --- a/plugins/official/checkstyle/dist/plugin.wasm.sources +++ b/plugins/official/checkstyle/dist/plugin.wasm.sources @@ -1 +1 @@ -7671635ca020d4ae590359dee691068a23449d75ec553fc9b265dccdaa0fa684 +0fa644f4fea5049f5b887b3805150ee67f7808cf6abd77cecfc4ecb30acded1f diff --git a/plugins/official/container-runner/dist/plugin.wasm b/plugins/official/container-runner/dist/plugin.wasm index 81a4b5542f..5fe4ae919b 100644 Binary files a/plugins/official/container-runner/dist/plugin.wasm and b/plugins/official/container-runner/dist/plugin.wasm differ diff --git a/plugins/official/container-runner/dist/plugin.wasm.sources b/plugins/official/container-runner/dist/plugin.wasm.sources index ce6688e02a..95470b0274 100644 --- a/plugins/official/container-runner/dist/plugin.wasm.sources +++ b/plugins/official/container-runner/dist/plugin.wasm.sources @@ -1 +1 @@ -277fc281b3fa914d9fee2d002e911d06a4f0f3a9e918c5ea1ae9298fdb807b66 +f79fd774efea2d0ebf15a66b890959880b675ef091271c2167f943163fe84e49 diff --git a/plugins/official/csv-editor/dist/plugin.wasm b/plugins/official/csv-editor/dist/plugin.wasm index 2a0504cad6..c19ea1525a 100644 Binary files a/plugins/official/csv-editor/dist/plugin.wasm and b/plugins/official/csv-editor/dist/plugin.wasm differ diff --git a/plugins/official/csv-editor/dist/plugin.wasm.sources b/plugins/official/csv-editor/dist/plugin.wasm.sources index 3ed64398f9..c934010f4f 100644 --- a/plugins/official/csv-editor/dist/plugin.wasm.sources +++ b/plugins/official/csv-editor/dist/plugin.wasm.sources @@ -1 +1 @@ -ee3eb799c9966c2c80bb7ad424d3121367caa9417568a65f854bc8d49f307e29 +11794e3ce437a5d82774206c5d6833bc0078a0c161aef5378e8a7abaf8aa396d diff --git a/plugins/official/git-toolbox/dist/plugin.wasm b/plugins/official/git-toolbox/dist/plugin.wasm index 998602f79a..35690fc813 100644 Binary files a/plugins/official/git-toolbox/dist/plugin.wasm and b/plugins/official/git-toolbox/dist/plugin.wasm differ diff --git a/plugins/official/git-toolbox/dist/plugin.wasm.sources b/plugins/official/git-toolbox/dist/plugin.wasm.sources index 2a67bd8afc..fdb11f1349 100644 --- a/plugins/official/git-toolbox/dist/plugin.wasm.sources +++ b/plugins/official/git-toolbox/dist/plugin.wasm.sources @@ -1 +1 @@ -ad06ac2e49390bd719d9f76e47960f7b31c9811cf1c1e3188f8f9f08cfb8e872 +3eefb6eb47688c2b57f6a4aad2e90d7dd0d4805586aa523dea4312fb33725330 diff --git a/plugins/official/graphviz/dist/plugin.wasm b/plugins/official/graphviz/dist/plugin.wasm index b1b9606c47..e872478831 100644 Binary files a/plugins/official/graphviz/dist/plugin.wasm and b/plugins/official/graphviz/dist/plugin.wasm differ diff --git a/plugins/official/graphviz/dist/plugin.wasm.sources b/plugins/official/graphviz/dist/plugin.wasm.sources index 1135d06e3b..a6d5511426 100644 --- a/plugins/official/graphviz/dist/plugin.wasm.sources +++ b/plugins/official/graphviz/dist/plugin.wasm.sources @@ -1 +1 @@ -aa241f27cced5c3aee46c4818a9a9d8649fe0b9aa6c9def7404a74a0135ed02b +7e1c74f797f5f7d968d29bf621709802c3fc0e2e4610bf38b2225e79b0b978dc diff --git a/plugins/official/key-promoter/dist/plugin.wasm b/plugins/official/key-promoter/dist/plugin.wasm index 3253b9ae08..460c5908de 100644 Binary files a/plugins/official/key-promoter/dist/plugin.wasm and b/plugins/official/key-promoter/dist/plugin.wasm differ diff --git a/plugins/official/key-promoter/dist/plugin.wasm.sources b/plugins/official/key-promoter/dist/plugin.wasm.sources index 1d25a7bfb0..3f517a316c 100644 --- a/plugins/official/key-promoter/dist/plugin.wasm.sources +++ b/plugins/official/key-promoter/dist/plugin.wasm.sources @@ -1 +1 @@ -230826d223bcbdb64b053a74063e2ec735557a09bb88f2162a526f36a3042dcd +0cb361ffacdae717e11921e59d7915f3a80cf20e6ddda255b2ae9b99489694af diff --git a/plugins/official/license-header/dist/plugin.wasm b/plugins/official/license-header/dist/plugin.wasm index 0e10babfbc..e5b04c4461 100644 Binary files a/plugins/official/license-header/dist/plugin.wasm and b/plugins/official/license-header/dist/plugin.wasm differ diff --git a/plugins/official/license-header/dist/plugin.wasm.sources b/plugins/official/license-header/dist/plugin.wasm.sources index 9769fb26a5..4aa04d1483 100644 --- a/plugins/official/license-header/dist/plugin.wasm.sources +++ b/plugins/official/license-header/dist/plugin.wasm.sources @@ -1 +1 @@ -cceee2cc6cb8ebb083d3fb68b9715570523b28c5dea3946097a168ce3262a0a5 +4252673a11e47da25c28443cfdd0ad35729ab29bbb4adf516b489dbffa3b8267 diff --git a/plugins/official/mybatis/dist/plugin.wasm b/plugins/official/mybatis/dist/plugin.wasm index 35ef67700c..1ca95fc199 100644 Binary files a/plugins/official/mybatis/dist/plugin.wasm and b/plugins/official/mybatis/dist/plugin.wasm differ diff --git a/plugins/official/mybatis/dist/plugin.wasm.sources b/plugins/official/mybatis/dist/plugin.wasm.sources index 0eda844c06..b2bfc6ee45 100644 --- a/plugins/official/mybatis/dist/plugin.wasm.sources +++ b/plugins/official/mybatis/dist/plugin.wasm.sources @@ -1 +1 @@ -5b9a6206e44fdec0d1351457cc0209110a20e5427014eb5be55f004dfb1f6de5 +641273bdb39963cad33932c52d63672735180896fb41ac53c045c4b9ec1ccde7 diff --git a/plugins/official/regex-tester/dist/plugin.wasm b/plugins/official/regex-tester/dist/plugin.wasm index 68a7f919b5..bc9f90553d 100644 Binary files a/plugins/official/regex-tester/dist/plugin.wasm and b/plugins/official/regex-tester/dist/plugin.wasm differ diff --git a/plugins/official/regex-tester/dist/plugin.wasm.sources b/plugins/official/regex-tester/dist/plugin.wasm.sources index afd29f43f7..dc51efb36a 100644 --- a/plugins/official/regex-tester/dist/plugin.wasm.sources +++ b/plugins/official/regex-tester/dist/plugin.wasm.sources @@ -1 +1 @@ -f4ab582e8e134d33e0cdea1e18f2cad6d6e46c6bd736c58996c1a54b61f35e25 +192d3e7ac64bbcd6aba3e362340c515eb2b9c5dbd2ad6ea361a7831628fdd48a diff --git a/plugins/official/solidity/dist/plugin.wasm b/plugins/official/solidity/dist/plugin.wasm index a56db99233..850d018121 100644 Binary files a/plugins/official/solidity/dist/plugin.wasm and b/plugins/official/solidity/dist/plugin.wasm differ diff --git a/plugins/official/solidity/dist/plugin.wasm.sources b/plugins/official/solidity/dist/plugin.wasm.sources index 7174e2b821..83a47145f2 100644 --- a/plugins/official/solidity/dist/plugin.wasm.sources +++ b/plugins/official/solidity/dist/plugin.wasm.sources @@ -1 +1 @@ -c142297e91cdde9023185a2d6ccdafae7c49efc4f391145946dedea663d90c91 +7e02a7f1da3dcec45131af5613e91730b590ccf301ead1f7a84936eb36f54335 diff --git a/plugins/official/string-tools/dist/plugin.wasm b/plugins/official/string-tools/dist/plugin.wasm index aed212a9f3..0cb929887a 100644 Binary files a/plugins/official/string-tools/dist/plugin.wasm and b/plugins/official/string-tools/dist/plugin.wasm differ diff --git a/plugins/official/string-tools/dist/plugin.wasm.sources b/plugins/official/string-tools/dist/plugin.wasm.sources index a87507b265..28413d66aa 100644 --- a/plugins/official/string-tools/dist/plugin.wasm.sources +++ b/plugins/official/string-tools/dist/plugin.wasm.sources @@ -1 +1 @@ -25ed07e1ec5123e182a62aa6b1e8f0411a04e54caa95e6a02a5cb091811cc78f +f61634fbb7a00f46820038ca71633664fd36edc7db9bd86ec7705606d5921ca6 diff --git a/plugins/official/test-runner/dist/plugin.wasm b/plugins/official/test-runner/dist/plugin.wasm index 1b9913b60c..0aa6fd2986 100644 Binary files a/plugins/official/test-runner/dist/plugin.wasm and b/plugins/official/test-runner/dist/plugin.wasm differ diff --git a/plugins/official/test-runner/dist/plugin.wasm.sources b/plugins/official/test-runner/dist/plugin.wasm.sources index a8769ca986..09f40f2d71 100644 --- a/plugins/official/test-runner/dist/plugin.wasm.sources +++ b/plugins/official/test-runner/dist/plugin.wasm.sources @@ -1 +1 @@ -3384c291454845793f3848411f9f09e49f61b847a14ca6b99b255bb358003751 +e9a12343170c53abf50e126adabd5f6956fae445f31f24ae4dff763c53220391 diff --git a/plugins/official/todo-finder/dist/plugin.wasm b/plugins/official/todo-finder/dist/plugin.wasm index 6d33759058..e543b40093 100644 Binary files a/plugins/official/todo-finder/dist/plugin.wasm and b/plugins/official/todo-finder/dist/plugin.wasm differ diff --git a/plugins/official/todo-finder/dist/plugin.wasm.sources b/plugins/official/todo-finder/dist/plugin.wasm.sources index ac963ae63d..dff1bbc784 100644 --- a/plugins/official/todo-finder/dist/plugin.wasm.sources +++ b/plugins/official/todo-finder/dist/plugin.wasm.sources @@ -1 +1 @@ -8e4da9f7e3844588038af581825d28be1a8b797b0433905cfbe47ad973c99d10 +8c7d46f44e87a400ca5a2bb205cf813ee3cff9eb659ad35f7bb024327834ae6e diff --git a/sdk/rust/openidea-plugin/src/execution.rs b/sdk/rust/openidea-plugin/src/execution.rs index d77ff09479..97a341e01b 100644 --- a/sdk/rust/openidea-plugin/src/execution.rs +++ b/sdk/rust/openidea-plugin/src/execution.rs @@ -86,6 +86,30 @@ pub struct PluginRunConfiguration { pub framework: Option<String>, } +/// RunStarted data exchanged with the IDE (API 1.21). +#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct RunStarted { + pub id: String, + pub config: String, + pub debug: bool, +} + +/// Draft passed to [`crate::host::upsert_run_configuration`] (API 1.21). +#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct RunConfigDraft { + pub id: Option<String>, + pub type_id: String, + pub name: String, + pub command: Option<String>, + pub args: Vec<String>, + pub cwd: Option<String>, + pub env: Vec<(String, String)>, + pub params: Vec<(String, String)>, + pub allow_parallel: bool, +} + /// RunExited data exchanged with the IDE. #[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] @@ -257,6 +281,10 @@ pub trait TestResults { } impl crate::Event { + /// Start of a run owned by this plugin (API 1.21). + pub fn run_started(&self) -> Option<RunStarted> { + self.execution_event("run-started") + } /// Completion of a run started by this plugin, even after idle reclamation. pub fn run_exited(&self) -> Option<RunExited> { self.execution_event("run-exited") diff --git a/sdk/rust/openidea-plugin/src/host.rs b/sdk/rust/openidea-plugin/src/host.rs index 1d07622d98..292dd64d69 100644 --- a/sdk/rust/openidea-plugin/src/host.rs +++ b/sdk/rust/openidea-plugin/src/host.rs @@ -1105,6 +1105,26 @@ mod imp { wit::run::start_with_options(config, args, wit::run::StartOptions { debug: options.debug, output_mode: mode }) .map_err(error) } + pub fn stop_run(id: &str) -> Result<(), Error> { + wit::run::stop(id).map_err(error) + } + pub fn upsert_run_configuration(draft: &crate::RunConfigDraft) -> Result<String, Error> { + wit::run::upsert_configuration(&wit::run::RunConfigDraft { + id: draft.id.clone(), + type_id: draft.type_id.clone(), + name: draft.name.clone(), + command: draft.command.clone(), + args: draft.args.clone(), + cwd: draft.cwd.clone(), + env: draft.env.clone(), + params: draft.params.clone(), + allow_parallel: draft.allow_parallel, + }) + .map_err(error) + } + pub fn open_edit_configurations(config_id: Option<&str>) -> Result<(), Error> { + wit::run::open_edit_configurations(config_id).map_err(error) + } pub fn open_terminal_session(key: &str, title: &str, cmd: &super::Command) -> Result<String, Error> { wit::views::open_terminal_session( key, @@ -2403,6 +2423,18 @@ pub fn start_run_with_options( ) -> Result<String, Error> { imp::start_run_with_options(config, args, options) } +/// Stops an active run started from one of this plugin's configurations (API 1.21). +pub fn stop_run(id: &str) -> Result<(), Error> { + imp::stop_run(id) +} +/// Creates or updates a saved run configuration of one of this plugin's own types (API 1.21). +pub fn upsert_run_configuration(draft: &crate::RunConfigDraft) -> Result<String, Error> { + imp::upsert_run_configuration(draft) +} +/// Opens the Run/Debug Configurations dialog, optionally selecting `config_id` (API 1.21). +pub fn open_edit_configurations(config_id: Option<&str>) -> Result<(), Error> { + imp::open_edit_configurations(config_id) +} /// Opens/reuses a keyed, approved terminal with append-only environment variables. pub fn open_terminal_session(key: &str, title: &str, cmd: &Command) -> Result<String, Error> { imp::open_terminal_session(key, title, cmd) diff --git a/sdk/rust/openidea-plugin/src/lib.rs b/sdk/rust/openidea-plugin/src/lib.rs index e13373773d..4545aef62e 100644 --- a/sdk/rust/openidea-plugin/src/lib.rs +++ b/sdk/rust/openidea-plugin/src/lib.rs @@ -116,7 +116,7 @@ pub mod completion_list_bindings { export_macro_name: "__export_completion_list_world", default_bindings_module: "openidea_plugin::completion_list_bindings", with: { - "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types, }, }); } @@ -133,7 +133,7 @@ pub mod providers_bindings { export_macro_name: "__export_editor_providers_world", default_bindings_module: "openidea_plugin::providers_bindings", with: { - "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types, }, }); } @@ -150,10 +150,10 @@ pub mod views_bindings { export_macro_name: "__export_views_world", default_bindings_module: "openidea_plugin::views_bindings", with: { - "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types, - "openidea:plugin/workspace@1.20.0": crate::bindings::openidea::plugin::workspace, - "openidea:plugin/editor@1.20.0": crate::bindings::openidea::plugin::editor, - "openidea:plugin/invocation@1.20.0": crate::bindings::openidea::plugin::invocation, + "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/workspace@1.21.0": crate::bindings::openidea::plugin::workspace, + "openidea:plugin/editor@1.21.0": crate::bindings::openidea::plugin::editor, + "openidea:plugin/invocation@1.21.0": crate::bindings::openidea::plugin::invocation, }, }); } @@ -165,7 +165,7 @@ pub mod indexing_bindings { world: "indexing", path: "wit", pub_export_macro: true, export_macro_name: "__export_indexing_world", default_bindings_module: "openidea_plugin::indexing_bindings", - with: { "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types }, }); } @@ -177,10 +177,10 @@ pub mod details_bindings { export_macro_name: "__export_details_world", default_bindings_module: "openidea_plugin::details_bindings", with: { - "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types, - "openidea:plugin/workspace@1.20.0": crate::bindings::openidea::plugin::workspace, - "openidea:plugin/editor@1.20.0": crate::bindings::openidea::plugin::editor, - "openidea:plugin/invocation@1.20.0": crate::bindings::openidea::plugin::invocation, + "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/workspace@1.21.0": crate::bindings::openidea::plugin::workspace, + "openidea:plugin/editor@1.21.0": crate::bindings::openidea::plugin::editor, + "openidea:plugin/invocation@1.21.0": crate::bindings::openidea::plugin::invocation, }, }); } @@ -192,7 +192,7 @@ pub mod semantic_bindings { world: "semantic-tokens", path: "wit", pub_export_macro: true, export_macro_name: "__export_semantic_tokens_world", default_bindings_module: "openidea_plugin::semantic_bindings", - with: { "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types }, }); } @@ -204,8 +204,8 @@ pub mod diagnostics_bindings { export_macro_name: "__export_diagnostics_world", default_bindings_module: "openidea_plugin::diagnostics_bindings", with: { - "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types, - "openidea:plugin/diagnostics@1.20.0": crate::bindings::openidea::plugin::diagnostics, + "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/diagnostics@1.21.0": crate::bindings::openidea::plugin::diagnostics, }, }); } @@ -217,7 +217,7 @@ pub mod hover_bindings { world: "hover", path: "wit", pub_export_macro: true, export_macro_name: "__export_hover_world", default_bindings_module: "openidea_plugin::hover_bindings", - with: { "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types }, }); } @@ -229,11 +229,11 @@ pub mod commit_checks_bindings { export_macro_name: "__export_commit_checks_world", default_bindings_module: "openidea_plugin::commit_checks_bindings", with: { - "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types, - "openidea:plugin/workspace@1.20.0": crate::bindings::openidea::plugin::workspace, - "openidea:plugin/editor@1.20.0": crate::bindings::openidea::plugin::editor, - "openidea:plugin/invocation@1.20.0": crate::bindings::openidea::plugin::invocation, - "openidea:plugin/commit@1.20.0": crate::bindings::openidea::plugin::commit, + "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/workspace@1.21.0": crate::bindings::openidea::plugin::workspace, + "openidea:plugin/editor@1.21.0": crate::bindings::openidea::plugin::editor, + "openidea:plugin/invocation@1.21.0": crate::bindings::openidea::plugin::invocation, + "openidea:plugin/commit@1.21.0": crate::bindings::openidea::plugin::commit, }, }); } @@ -245,7 +245,7 @@ pub mod inlay_bindings { world: "inlay-hints", path: "wit", pub_export_macro: true, export_macro_name: "__export_inlay_hints_world", default_bindings_module: "openidea_plugin::inlay_bindings", - with: { "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types }, }); } @@ -256,7 +256,7 @@ pub mod syntax_decoration_bindings { world: "syntax-decorations", path: "wit", pub_export_macro: true, export_macro_name: "__export_syntax_decorations_world", default_bindings_module: "openidea_plugin::syntax_decoration_bindings", - with: { "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types }, }); } @@ -267,7 +267,7 @@ pub mod file_actions_bindings { world: "file-actions-provider", path: "wit", pub_export_macro: true, export_macro_name: "__export_file_actions_world", default_bindings_module: "openidea_plugin::file_actions_bindings", - with: { "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types }, }); } @@ -279,10 +279,10 @@ pub mod endpoints_bindings { export_macro_name: "__export_endpoints_world", default_bindings_module: "openidea_plugin::endpoints_bindings", with: { - "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types, - "openidea:plugin/workspace@1.20.0": crate::bindings::openidea::plugin::workspace, - "openidea:plugin/editor@1.20.0": crate::bindings::openidea::plugin::editor, - "openidea:plugin/invocation@1.20.0": crate::bindings::openidea::plugin::invocation, + "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/workspace@1.21.0": crate::bindings::openidea::plugin::workspace, + "openidea:plugin/editor@1.21.0": crate::bindings::openidea::plugin::editor, + "openidea:plugin/invocation@1.21.0": crate::bindings::openidea::plugin::invocation, }, }); } @@ -295,16 +295,16 @@ pub mod search_bindings { export_macro_name: "__export_search_world", default_bindings_module: "openidea_plugin::search_bindings", with: { - "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types, - "openidea:plugin/workspace@1.20.0": crate::bindings::openidea::plugin::workspace, - "openidea:plugin/editor@1.20.0": crate::bindings::openidea::plugin::editor, - "openidea:plugin/invocation@1.20.0": crate::bindings::openidea::plugin::invocation, + "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/workspace@1.21.0": crate::bindings::openidea::plugin::workspace, + "openidea:plugin/editor@1.21.0": crate::bindings::openidea::plugin::editor, + "openidea:plugin/invocation@1.21.0": crate::bindings::openidea::plugin::invocation, }, }); } /// The plugin API version this SDK targets. -pub const API_VERSION: &str = "1.20"; +pub const API_VERSION: &str = "1.21"; /// A plugin. One instance lives as long as the plugin's Wasm instance (until /// it is disabled, crashes or is reclaimed when idle). @@ -452,9 +452,12 @@ macro_rules! __completion_list_exports { $crate::__rt::completion_list::<$plugin>(doc, at, trigger) } } - $crate::completion_list_bindings::__export_completion_list_world!( - $component with_types_in $crate::completion_list_bindings - ); + #[allow(dead_code)] + fn __z_export_compllist() { + $crate::completion_list_bindings::__export_completion_list_world!( + $component with_types_in $crate::completion_list_bindings + ); + } }; } @@ -497,9 +500,12 @@ macro_rules! __hover_actions_exports { .collect() } } - $crate::hover_actions_bindings::__export_hover_actions_world!( - $component with_types_in $crate::hover_actions_bindings - ); + #[allow(dead_code)] + fn __z_export_hoveractions() { + $crate::hover_actions_bindings::__export_hover_actions_world!( + $component with_types_in $crate::hover_actions_bindings + ); + } }; } @@ -555,7 +561,10 @@ macro_rules! __providers_exports { } } - $crate::providers_bindings::__export_editor_providers_world!($component with_types_in $crate::providers_bindings); + #[allow(dead_code)] + fn __a_export_providers() { + $crate::providers_bindings::__export_editor_providers_world!($component with_types_in $crate::providers_bindings); + } }; } @@ -1682,7 +1691,7 @@ pub mod run_configurations_bindings { pub mod launch_configurations_bindings { wit_bindgen::generate!({ world: "launch-configurations-provider", path: "wit", pub_export_macro: true, export_macro_name: "__export_launch_configurations_world", default_bindings_module: "openidea_plugin::launch_configurations_bindings", - with: { "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types }, }); } #[cfg(target_arch = "wasm32")] @@ -1691,8 +1700,8 @@ pub mod execution_configurations_bindings { wit_bindgen::generate!({ world: "execution-configurations-provider", path: "wit", pub_export_macro: true, export_macro_name: "__export_execution_configurations_world", default_bindings_module: "openidea_plugin::execution_configurations_bindings", with: { - "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types, - "openidea:plugin/run@1.20.0": crate::bindings::openidea::plugin::run, + "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/run@1.21.0": crate::bindings::openidea::plugin::run, }, }); } @@ -1701,7 +1710,7 @@ pub mod execution_configurations_bindings { pub mod test_results_bindings { wit_bindgen::generate!({ world: "test-results-provider", path: "wit", pub_export_macro: true, export_macro_name: "__export_tests_world", default_bindings_module: "openidea_plugin::test_results_bindings", - with: { "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types }, }); } #[doc(hidden)] @@ -1725,7 +1734,10 @@ macro_rules! __launch_configurations_exports { $crate::__rt::launch_configurations::<$plugin>(&root) } } - $crate::launch_configurations_bindings::__export_launch_configurations_world!($component with_types_in $crate::launch_configurations_bindings); + #[allow(dead_code)] + fn __a_export_launchconfigs() { + $crate::launch_configurations_bindings::__export_launch_configurations_world!($component with_types_in $crate::launch_configurations_bindings); + } }; } #[doc(hidden)] @@ -1737,7 +1749,10 @@ macro_rules! __execution_configurations_exports { $crate::__rt::execution_configurations::<$plugin>(&root) } } - $crate::execution_configurations_bindings::__export_execution_configurations_world!($component with_types_in $crate::execution_configurations_bindings); + #[allow(dead_code)] + fn __z_export_execconfigs__() { + $crate::execution_configurations_bindings::__export_execution_configurations_world!($component with_types_in $crate::execution_configurations_bindings); + } }; } #[doc(hidden)] @@ -1763,7 +1778,7 @@ pub mod language_features; pub mod language_features_bindings { wit_bindgen::generate!({world: "editor-language-features", path: "wit", pub_export_macro: true, export_macro_name: "__export_language_features_world", default_bindings_module: "openidea_plugin::language_features_bindings", - with: { "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types }, }); } @@ -1786,7 +1801,10 @@ fn implementation(doc: $crate::language_features_bindings::exports::openidea::pl fn type_definition(doc: $crate::language_features_bindings::exports::openidea::plugin::language_features::Document, at: $crate::bindings::openidea::plugin::types::Position) -> Vec<$crate::bindings::openidea::plugin::types::Location> { $crate::language_features::wasm::type_definition::<$plugin>(doc, at) } fn gutter_actions(doc: $crate::language_features_bindings::exports::openidea::plugin::language_features::Document) -> Vec<$crate::language_features_bindings::exports::openidea::plugin::language_features::GutterAction> { $crate::language_features::wasm::gutter_actions::<$plugin>(doc) } } - $crate::language_features_bindings::__export_language_features_world!($component with_types_in $crate::language_features_bindings); + #[allow(dead_code)] + fn __a_export_langfeatures() { + $crate::language_features_bindings::__export_language_features_world!($component with_types_in $crate::language_features_bindings); + } }; } @@ -1795,7 +1813,7 @@ fn gutter_actions(doc: $crate::language_features_bindings::exports::openidea::pl pub mod injections_bindings { wit_bindgen::generate!({world: "language-injections", path: "wit", pub_export_macro: true, export_macro_name: "__export_injections_world", default_bindings_module: "openidea_plugin::injections_bindings", - with: { "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types }, }); } @@ -1825,8 +1843,8 @@ pub mod mcp_bindings { wit_bindgen::generate!({ world: "mcp-tools", path: "wit", pub_export_macro: true, export_macro_name: "__export_mcp_world", default_bindings_module: "openidea_plugin::mcp_bindings", with: { - "openidea:plugin/types@1.20.0": crate::bindings::openidea::plugin::types, - "openidea:plugin/invocation@1.20.0": crate::bindings::openidea::plugin::invocation, + "openidea:plugin/types@1.21.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/invocation@1.21.0": crate::bindings::openidea::plugin::invocation, }, }); } diff --git a/sdk/rust/openidea-plugin/src/mock.rs b/sdk/rust/openidea-plugin/src/mock.rs index b7873e32bd..f9264396c1 100644 --- a/sdk/rust/openidea-plugin/src/mock.rs +++ b/sdk/rust/openidea-plugin/src/mock.rs @@ -215,6 +215,9 @@ struct State { run_remote_targets: BTreeSet<String>, configuration_runs: Vec<(String, String, Vec<String>, bool)>, configuration_run_options: Vec<(String, String, Vec<String>, crate::RunStartOptions, crate::OutputMode)>, + stopped_runs: Vec<String>, + saved_run_configs: BTreeMap<String, crate::RunConfigDraft>, + opened_edit_configs: Vec<Option<String>>, /// `(agent, session_id, cwd)` of each `fork_agent_session` call. agent_forks: Vec<(String, String, String)>, log_tabs: Vec<MockLogTab>, @@ -780,6 +783,18 @@ impl MockHost { ) -> Vec<(String, String, Vec<String>, crate::RunStartOptions, crate::OutputMode)> { self.state.borrow().configuration_run_options.clone() } + /// Run ids stopped via `host::stop_run` (API 1.21). + pub fn stopped_runs(&self) -> Vec<String> { + self.state.borrow().stopped_runs.clone() + } + /// Saved configurations created/updated via `host::upsert_run_configuration` (API 1.21). + pub fn saved_run_configs(&self) -> BTreeMap<String, crate::RunConfigDraft> { + self.state.borrow().saved_run_configs.clone() + } + /// Calls recorded to `host::open_edit_configurations` (API 1.21). + pub fn opened_edit_configurations(&self) -> Vec<Option<String>> { + self.state.borrow().opened_edit_configs.clone() + } /// Recorded `fork_agent_session` calls as `(agent, session_id, cwd)` (API 1.18). pub fn agent_forks(&self) -> Vec<(String, String, String)> { self.state.borrow().agent_forks.clone() @@ -2374,6 +2389,7 @@ pub mod current { let cap = match kind { EventKind::ActionPerformed | EventKind::InputModeChanged => Some("events.input"), EventKind::Scheduled + | EventKind::RunStarted | EventKind::RunExited | EventKind::TerminalExited | EventKind::ContentTabAction => None, @@ -2993,6 +3009,34 @@ pub mod current { Ok(id) }) } + pub fn stop_run(id: &str) -> Result<(), Error> { + with(|s| { + if !s.configuration_runs.iter().any(|(run_id, ..)| run_id == id) { + return Err(Error::NotFound(format!("no active run `{id}`"))); + } + s.stopped_runs.push(id.to_owned()); + Ok(()) + }) + } + pub fn upsert_run_configuration(draft: &crate::RunConfigDraft) -> Result<String, Error> { + with(|s| { + if draft.name.trim().is_empty() || draft.type_id.trim().is_empty() { + return Err(Error::Invalid("configuration name and type_id are required".into())); + } + let id = draft + .id + .clone() + .unwrap_or_else(|| format!("plugin:mock:{}:{}", draft.type_id, s.saved_run_configs.len() + 1)); + s.saved_run_configs.insert(id.clone(), draft.clone()); + Ok(id) + }) + } + pub fn open_edit_configurations(config_id: Option<&str>) -> Result<(), Error> { + with(|s| { + s.opened_edit_configs.push(config_id.map(str::to_owned)); + Ok(()) + }) + } pub fn open_terminal_session(key: &str, title: &str, cmd: &crate::host::Command) -> Result<String, Error> { command_env(cmd)?; with(|s| { diff --git a/sdk/rust/openidea-plugin/src/types.rs b/sdk/rust/openidea-plugin/src/types.rs index d001718b8e..75d508ccb0 100644 --- a/sdk/rust/openidea-plugin/src/types.rs +++ b/sdk/rust/openidea-plugin/src/types.rs @@ -361,6 +361,7 @@ pub enum EventKind { FileClosed, SettingsChanged, InputModeChanged, + RunStarted, RunExited, TerminalExited, ContentTabAction, @@ -395,6 +396,7 @@ impl EventKind { Self::FileClosed => "file-closed", Self::SettingsChanged => "settings-changed", Self::InputModeChanged => "input-mode-changed", + Self::RunStarted => "run-started", Self::RunExited => "run-exited", Self::TerminalExited => "terminal-exited", Self::ContentTabAction => "content-tab-action", diff --git a/sdk/rust/openidea-plugin/tests/api21_run_config_apis.rs b/sdk/rust/openidea-plugin/tests/api21_run_config_apis.rs new file mode 100644 index 0000000000..4c16035706 --- /dev/null +++ b/sdk/rust/openidea-plugin/tests/api21_run_config_apis.rs @@ -0,0 +1,56 @@ +use openidea_plugin::{ + Debugger, Error, Event, EventKind, OutputMode, PluginExecutionConfiguration, PluginLaunchConfiguration, + PluginRunConfiguration, RunConfigDraft, RunStarted, host, mock::MockHost, +}; + +#[test] +fn run_lifecycle_upsert_and_edit_dialog_work_in_mock() { + let mock = MockHost::install().with_capabilities(&["process:java"]); + host::subscribe(EventKind::RunStarted).unwrap(); + + mock.set_execution_configurations(vec![PluginExecutionConfiguration { + launch: PluginLaunchConfiguration { + config: PluginRunConfiguration { + id: "tomcat".into(), + name: "Tomcat".into(), + program: "java".into(), + args: vec!["-version".into()], + cwd: None, + test: false, + framework: None, + }, + env: vec![], + debugger: Some(Debugger::AttachChild { kind: "java".into(), command_contains: Some("Bootstrap".into()) }), + }, + output_mode: OutputMode::Pipes, + }]); + + let run_id = host::start_run("tomcat", &[], true).unwrap(); + host::stop_run(&run_id).unwrap(); + assert_eq!(mock.stopped_runs(), vec![run_id.clone()]); + assert!(matches!(host::stop_run("missing"), Err(Error::NotFound(_)))); + + let ev = Event::Other { + kind: "run-started".into(), + data: format!(r#"{{"id":"{run_id}","config":"tomcat","debug":true}}"#), + }; + assert_eq!(ev.run_started(), Some(RunStarted { id: run_id, config: "tomcat".into(), debug: true })); + + let saved_id = host::upsert_run_configuration(&RunConfigDraft { + id: None, + type_id: "smart-tomcat-pro".into(), + name: "My App".into(), + command: None, + args: vec![], + cwd: None, + env: vec![("PORT".into(), "8080".into())], + params: vec![("serverName".into(), "Tomcat 10".into())], + allow_parallel: false, + }) + .unwrap(); + assert_eq!(mock.saved_run_configs().get(&saved_id).unwrap().name, "My App"); + + host::open_edit_configurations(Some(&saved_id)).unwrap(); + host::open_edit_configurations(None).unwrap(); + assert_eq!(mock.opened_edit_configurations(), vec![Some(saved_id), None]); +} diff --git a/sdk/rust/openidea-plugin/wit/agents.wit b/sdk/rust/openidea-plugin/wit/agents.wit index d5b0b101a4..b5d9918262 100644 --- a/sdk/rust/openidea-plugin/wit/agents.wit +++ b/sdk/rust/openidea-plugin/wit/agents.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Forking recorded native agent sessions into new tasks (API 1.18). Requires /// the `agents` capability. The session must belong to the invoking window's diff --git a/sdk/rust/openidea-plugin/wit/commit.wit b/sdk/rust/openidea-plugin/wit/commit.wit index 94a1c2882b..20426a680d 100644 --- a/sdk/rust/openidea-plugin/wit/commit.wit +++ b/sdk/rust/openidea-plugin/wit/commit.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// The commit being prepared in the window the current command or event came /// from (the Commit tool window, or the Commit dialog while it is open): the diff --git a/sdk/rust/openidea-plugin/wit/completion-list.wit b/sdk/rust/openidea-plugin/wit/completion-list.wit index 34d283648d..e6bba755cb 100644 --- a/sdk/rust/openidea-plugin/wit/completion-list.wit +++ b/sdk/rust/openidea-plugin/wit/completion-list.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Optional export (API 1.16, world `plugin-completion-list`): completion that /// can say its list is incomplete. A plugin exporting it is called instead of diff --git a/sdk/rust/openidea-plugin/wit/database.wit b/sdk/rust/openidea-plugin/wit/database.wit index 0284b0e9da..dc6daf0eae 100644 --- a/sdk/rust/openidea-plugin/wit/database.wit +++ b/sdk/rust/openidea-plugin/wit/database.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Plugin-owned project data sources. Requires database.sources and project trust. /// Runs on the Database subsystem's host, including on remote project servers. diff --git a/sdk/rust/openidea-plugin/wit/decorations.wit b/sdk/rust/openidea-plugin/wit/decorations.wit index d7bc073934..90e3ea0d00 100644 --- a/sdk/rust/openidea-plugin/wit/decorations.wit +++ b/sdk/rust/openidea-plugin/wit/decorations.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Editor and project-tree decorations (API 1.4). Requires project.read. An editor set /// follows its file: the file's own project, or the nearest one when it is outside them all. diff --git a/sdk/rust/openidea-plugin/wit/details.wit b/sdk/rust/openidea-plugin/wit/details.wit index ec0948bc00..1bedc44ba0 100644 --- a/sdk/rust/openidea-plugin/wit/details.wit +++ b/sdk/rust/openidea-plugin/wit/details.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// What the pane beside the Services tree shows for a plugin's node. interface detail-types { diff --git a/sdk/rust/openidea-plugin/wit/diagnostics.wit b/sdk/rust/openidea-plugin/wit/diagnostics.wit index 9f4d97d979..ee9d420d83 100644 --- a/sdk/rust/openidea-plugin/wit/diagnostics.wit +++ b/sdk/rust/openidea-plugin/wit/diagnostics.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Optional export (world `plugin-diagnostics`): problems in the current, /// possibly unsaved document, for the languages declared with the diff --git a/sdk/rust/openidea-plugin/wit/endpoints.wit b/sdk/rust/openidea-plugin/wit/endpoints.wit index b10ed5d8cd..ebf7647e01 100644 --- a/sdk/rust/openidea-plugin/wit/endpoints.wit +++ b/sdk/rust/openidea-plugin/wit/endpoints.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// HTTP endpoints found in a project (`[[contributes.endpoints]]`). interface endpoints-provider { diff --git a/sdk/rust/openidea-plugin/wit/events.wit b/sdk/rust/openidea-plugin/wit/events.wit index 740294de6e..83bce90173 100644 --- a/sdk/rust/openidea-plugin/wit/events.wit +++ b/sdk/rust/openidea-plugin/wit/events.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Workbench events, delivered in batches to `event-handler.handle`. interface events { @@ -41,13 +41,16 @@ interface events { /// work waits for it; it requires `events`) through `other`. /// API 1.18 also delivers `project-closed` (JSON project root string) and /// `watched-files-changed` (see `watch-paths`) through `other`. + /// API 1.21 also delivers `run-started` (JSON {id, config, debug}) through `other` + /// whenever one of this plugin's configurations starts (whether launched by the plugin + /// or by the user), and delivers `run-exited` for user-launched plugin configurations too. /// Kinds: `file-opened`, `file-saved`, `document-changed` (versioned UTF-16 /// replacements from explicit path subscriptions), `websocket-ready` /// (a host-owned connection has messages to drain), `caret-moved`, `files-changed` (batched disk changes /// as `other`, with created/modified/removed path lists in JSON), `editor-focused` (the focused editor /// changed), `vcs-changed` (a repository's state changed: commit, /// checkout, fetch…), `action-performed` (an IDE action ran), - /// `project-closed` (a project closed) and + /// `project-closed` (a project closed), `run-started`, `run-exited`, and /// `scheduled` (the `on-schedule` period elapsed); later IDEs add more, /// and an IDE that doesn't know one fails with `invalid`. /// Requires `events` (`events.input` for `action-performed`). diff --git a/sdk/rust/openidea-plugin/wit/exports.wit b/sdk/rust/openidea-plugin/wit/exports.wit index 96592f8003..d352203adc 100644 --- a/sdk/rust/openidea-plugin/wit/exports.wit +++ b/sdk/rust/openidea-plugin/wit/exports.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; interface lifecycle { use types.{context, error}; diff --git a/sdk/rust/openidea-plugin/wit/extensions.wit b/sdk/rust/openidea-plugin/wit/extensions.wit index f5e081470e..3492888e1c 100644 --- a/sdk/rust/openidea-plugin/wit/extensions.wit +++ b/sdk/rust/openidea-plugin/wit/extensions.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// What other plugins contributed to the extension points this plugin declares /// (`[[extension-points]]` in `plugin.toml`; the contributors list this plugin diff --git a/sdk/rust/openidea-plugin/wit/file-actions.wit b/sdk/rust/openidea-plugin/wit/file-actions.wit index 0a0f66690c..d386fe7bb7 100644 --- a/sdk/rust/openidea-plugin/wit/file-actions.wit +++ b/sdk/rust/openidea-plugin/wit/file-actions.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Optional export (world `plugin-file-actions`): quick fixes and /// refactorings that create, rename or delete files, next to the text edits diff --git a/sdk/rust/openidea-plugin/wit/fs.wit b/sdk/rust/openidea-plugin/wit/fs.wit index 5eb436bd81..ecd6cb9411 100644 --- a/sdk/rust/openidea-plugin/wit/fs.wit +++ b/sdk/rust/openidea-plugin/wit/fs.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Files outside the open projects: the configuration of the program a /// plugin integrates with, a tool installed elsewhere, a licence file. diff --git a/sdk/rust/openidea-plugin/wit/host.wit b/sdk/rust/openidea-plugin/wit/host.wit index 1e131c6372..cfce1430bf 100644 --- a/sdk/rust/openidea-plugin/wit/host.wit +++ b/sdk/rust/openidea-plugin/wit/host.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Writes to the IDE log, tagged with the plugin id. interface log { diff --git a/sdk/rust/openidea-plugin/wit/hover-actions.wit b/sdk/rust/openidea-plugin/wit/hover-actions.wit index 070c66a2bc..b7f3fa778e 100644 --- a/sdk/rust/openidea-plugin/wit/hover-actions.wit +++ b/sdk/rust/openidea-plugin/wit/hover-actions.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Optional export (world `plugin-hover-actions`): clickable actions rendered /// at the left edge of a line and revealed while the pointer is in the leftmost diff --git a/sdk/rust/openidea-plugin/wit/hover.wit b/sdk/rust/openidea-plugin/wit/hover.wit index c9be10359f..726313f77c 100644 --- a/sdk/rust/openidea-plugin/wit/hover.wit +++ b/sdk/rust/openidea-plugin/wit/hover.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Optional export (world `plugin-hover`): Markdown added to the hover of /// documents of the languages declared with the `hover` provider kind, diff --git a/sdk/rust/openidea-plugin/wit/indexing.wit b/sdk/rust/openidea-plugin/wit/indexing.wit index 7453f3ffe3..1c1bfe960b 100644 --- a/sdk/rust/openidea-plugin/wit/indexing.wit +++ b/sdk/rust/openidea-plugin/wit/indexing.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Cross-file associations a plugin publishes for the files it declares under /// `[[contributes.documentIndexers]]`. The host calls `index` in cancellable diff --git a/sdk/rust/openidea-plugin/wit/injections.wit b/sdk/rust/openidea-plugin/wit/injections.wit index 10608d5f6c..e2c79c58b1 100644 --- a/sdk/rust/openidea-plugin/wit/injections.wit +++ b/sdk/rust/openidea-plugin/wit/injections.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Embedded languages. The host routes plugin providers and configured language /// servers inside these ranges, preserving host-document UTF-16 coordinates. diff --git a/sdk/rust/openidea-plugin/wit/inlay.wit b/sdk/rust/openidea-plugin/wit/inlay.wit index b6d1498e65..78e483cd33 100644 --- a/sdk/rust/openidea-plugin/wit/inlay.wit +++ b/sdk/rust/openidea-plugin/wit/inlay.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Optional export (world `plugin-inlay-hints`): inline hints in documents of /// the languages declared with the `inlay-hints` provider kind, including diff --git a/sdk/rust/openidea-plugin/wit/io.wit b/sdk/rust/openidea-plugin/wit/io.wit index d9f3354a47..77f41019cf 100644 --- a/sdk/rust/openidea-plugin/wit/io.wit +++ b/sdk/rust/openidea-plugin/wit/io.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Problems in files, shown in the editor and the Problems view. interface diagnostics { diff --git a/sdk/rust/openidea-plugin/wit/language-features.wit b/sdk/rust/openidea-plugin/wit/language-features.wit index 1a6a722d4b..9abd049e42 100644 --- a/sdk/rust/openidea-plugin/wit/language-features.wit +++ b/sdk/rust/openidea-plugin/wit/language-features.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Additional language features, called only for declared API 1.4 provider kinds. /// Editor calls have a 50 ms soft / 500 ms hard budget; formatting has 5 seconds. diff --git a/sdk/rust/openidea-plugin/wit/mcp.wit b/sdk/rust/openidea-plugin/wit/mcp.wit index c1de914ec7..e2a6f0d65d 100644 --- a/sdk/rust/openidea-plugin/wit/mcp.wit +++ b/sdk/rust/openidea-plugin/wit/mcp.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Discovery of the IDE's built-in MCP server; never exposes its URL or token. interface mcp { diff --git a/sdk/rust/openidea-plugin/wit/plugin.wit b/sdk/rust/openidea-plugin/wit/plugin.wit index e802e21e13..42a119bcef 100644 --- a/sdk/rust/openidea-plugin/wit/plugin.wit +++ b/sdk/rust/openidea-plugin/wit/plugin.wit @@ -8,7 +8,7 @@ /// `fs` and `workspace`, and 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.20.0; +package openidea:plugin@1.21.0; world plugin { import log; diff --git a/sdk/rust/openidea-plugin/wit/providers.wit b/sdk/rust/openidea-plugin/wit/providers.wit index 2fb49ff34c..245f2c6d51 100644 --- a/sdk/rust/openidea-plugin/wit/providers.wit +++ b/sdk/rust/openidea-plugin/wit/providers.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Editor features a plugin provides for the languages it declares under /// `[[contributes.providers]]` (the host calls only declared kinds). They run diff --git a/sdk/rust/openidea-plugin/wit/run-targets.wit b/sdk/rust/openidea-plugin/wit/run-targets.wit index 2495bc1ce4..1b51595a55 100644 --- a/sdk/rust/openidea-plugin/wit/run-targets.wit +++ b/sdk/rust/openidea-plugin/wit/run-targets.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Project-scoped targets owned by the registering plugin (API 1.4). interface run-targets { diff --git a/sdk/rust/openidea-plugin/wit/run.wit b/sdk/rust/openidea-plugin/wit/run.wit index 6bfb18b74d..33f1dc3b35 100644 --- a/sdk/rust/openidea-plugin/wit/run.wit +++ b/sdk/rust/openidea-plugin/wit/run.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Launches this plugin's configurations in the invoking window's Run tool window. interface run { @@ -24,6 +24,30 @@ interface run { start: func(config: string, args: list<string>, debug: bool) -> result<string, error>; /// Starts an owned configuration with launch options, appending args (API 1.18). start-with-options: func(config: string, args: list<string>, options: start-options) -> result<string, error>; + /// Stops an active run started from one of this plugin's configurations (API 1.21). + /// Only from a window command/event. + stop: func(id: string) -> result<_, error>; + /// Payload for `upsert-configuration` (API 1.21). + record run-config-draft { + /// Existing saved config id to update (`none` creates a new configuration). + id: option<string>, + /// Id from one of this plugin's own `[[contributes.runConfigTypes]]`. + type-id: string, + name: string, + command: option<string>, + args: list<string>, + cwd: option<string>, + env: list<tuple<string, string>>, + params: list<tuple<string, string>>, + allow-parallel: bool, + } + /// Creates or updates a saved run configuration of one of this plugin's own + /// `contributes.runConfigTypes` in the invoking window's project (API 1.21). + /// Returns the saved configuration id. + upsert-configuration: func(draft: run-config-draft) -> result<string, error>; + /// Opens the Run/Debug Configurations dialog in the invoking window, optionally + /// selecting `config-id` (API 1.21). + open-edit-configurations: func(config-id: option<string>) -> result<_, error>; } /// Optional dynamic configurations, refreshed alongside run detectors. diff --git a/sdk/rust/openidea-plugin/wit/search.wit b/sdk/rust/openidea-plugin/wit/search.wit index 775cc03415..f5148ed49f 100644 --- a/sdk/rust/openidea-plugin/wit/search.wit +++ b/sdk/rust/openidea-plugin/wit/search.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// On-demand results for `[[contributes.searchCategories]]`. Optional, API 1.13. interface search-provider { diff --git a/sdk/rust/openidea-plugin/wit/semantic.wit b/sdk/rust/openidea-plugin/wit/semantic.wit index 551db318d7..3829da74b1 100644 --- a/sdk/rust/openidea-plugin/wit/semantic.wit +++ b/sdk/rust/openidea-plugin/wit/semantic.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Optional export (world `plugin-semantic-tokens`): semantic colouring of /// documents of the languages declared with the `semantic-tokens` provider diff --git a/sdk/rust/openidea-plugin/wit/syntax-decorations.wit b/sdk/rust/openidea-plugin/wit/syntax-decorations.wit index 3c5bdb4c32..84018b27a7 100644 --- a/sdk/rust/openidea-plugin/wit/syntax-decorations.wit +++ b/sdk/rust/openidea-plugin/wit/syntax-decorations.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Optional export (world `plugin-syntax-decorations`): foreground marks for /// documents of the languages declared with the `syntax-decorations` provider diff --git a/sdk/rust/openidea-plugin/wit/types.wit b/sdk/rust/openidea-plugin/wit/types.wit index d28702152d..90eca253a9 100644 --- a/sdk/rust/openidea-plugin/wit/types.wit +++ b/sdk/rust/openidea-plugin/wit/types.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Shared types. Positions are 0-based lines and UTF-16 code unit columns, /// as in the editor and LSP. diff --git a/sdk/rust/openidea-plugin/wit/views.wit b/sdk/rust/openidea-plugin/wit/views.wit index 9733418473..47a1d8e1ea 100644 --- a/sdk/rust/openidea-plugin/wit/views.wit +++ b/sdk/rust/openidea-plugin/wit/views.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Declarative views: tool windows declared /// under `[[contributes.views]]` and custom editors under diff --git a/sdk/rust/openidea-plugin/wit/workspace.wit b/sdk/rust/openidea-plugin/wit/workspace.wit index d96234945a..a828cb3064 100644 --- a/sdk/rust/openidea-plugin/wit/workspace.wit +++ b/sdk/rust/openidea-plugin/wit/workspace.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; interface workspace { use types.{error, location}; diff --git a/src-tauri/tests/commands.snap b/src-tauri/tests/commands.snap index 5ddcc7f883..bcc3c7730a 100644 --- a/src-tauri/tests/commands.snap +++ b/src-tauri/tests/commands.snap @@ -604,6 +604,7 @@ plugin_run_anything_run trusted project_host bin plugin_run_anything_suggest trusted project_host bindings async plugin_run_command trusted project_host bindings async plugin_run_configuration_complete trusted project_host bindings async +plugin_run_log_tail trusted project_host bindings async plugin_run_targets trusted project_host bindings async plugin_search trusted project_host bindings async plugin_secrets trusted desktop bindings async diff --git a/src/bindings.ts b/src/bindings.ts index 60d8171daa..6bac83ef08 100644 --- a/src/bindings.ts +++ b/src/bindings.ts @@ -1677,6 +1677,8 @@ export const commands = { } | null, paths: string[] | null, settingsScope: "global" | "project" | null, commandChain: string[] | null, request: number | null) => typedError<string | null, IdeError>(__TAURI_INVOKE("plugin_run_command", { pluginId, commandId, arg, editor, paths, settingsScope, commandChain, request })), /** Completions for a field of a plugin's own run configuration (API 1.18). */ pluginRunConfigurationComplete: (configId: string, field: string, text: string, caret: number) => typedError<RunConfigCompletion[], IdeError>(__TAURI_INVOKE("plugin_run_configuration_complete", { configId, field, text, caret })), + /** Reads an incremental chunk of an authorized log file for a plugin run session. */ + pluginRunLogTail: (pluginId: string, path: string, offset: number, maxBytes: number | null) => typedError<PluginLogTailChunk, IdeError>(__TAURI_INVOKE("plugin_run_log_tail", { pluginId, path, offset, maxBytes })), pluginRunTargets: () => typedError<RegisteredRunTarget[], IdeError>(__TAURI_INVOKE("plugin_run_targets")), /** * One page of `plugin_id`'s results for its search `category`. Cancellable with @@ -9381,7 +9383,7 @@ export type ErrorKind = "notFound" | "alreadyExists" | "permissionDenied" | "inv "unavailable" | "io" | "protocol" | "internal"; /** Kinds of workbench events a plugin can subscribe to (`on-event:<kind>`). */ -export type EventKind = "document-changed" | "websocket-ready" | "file-closed" | "settings-changed" | "input-mode-changed" | "run-exited" | "terminal-exited" | "content-tab-action" | "extensions-changed" | "file-opened" | "file-saved" | "files-changed" | "editor-focused" | "caret-moved" | "action-performed" | "vcs-changed" | +export type EventKind = "document-changed" | "websocket-ready" | "file-closed" | "settings-changed" | "input-mode-changed" | "run-started" | "run-exited" | "terminal-exited" | "content-tab-action" | "extensions-changed" | "file-opened" | "file-saved" | "files-changed" | "editor-focused" | "caret-moved" | "action-performed" | "vcs-changed" | /** Problems of the window's files changed (a language server or a report). */ "problems-changed" | /** A project was closed (or its window closed): the project root path. */ @@ -14379,6 +14381,14 @@ export type PluginLocation = { range: Range, }; +/** Bounded slice of a log file tailed for a plugin run console tab. */ +export type PluginLogTailChunk = { + content: string, + offset: number, + truncated: boolean, + exists: boolean, +}; + /** A `net:setting:` grant's host for Settings › Plugins: the approved one while the setting holds it, else the pending one. */ export type PluginNetSetting = { /** The setting key the host comes from (`server` of `net:setting:server`). */ @@ -15954,6 +15964,19 @@ export type RunConfigCompletion = { replaceEnd: number, }; +/** Draft passed to `run.upsert-configuration` (API 1.21). */ +export type RunConfigDraft = { + id: string | null, + typeId: string, + name: string, + command: string | null, + args: string[], + cwd: string | null, + env: ([string, string])[], + params: ([string, string])[], + allowParallel: boolean, +}; + export type RunConfig_Deserialize = { /** Stable id, e.g. `npm:dev`, `cargo:run:app`, or a uuid for user-defined. */ id: string, @@ -16173,6 +16196,13 @@ export type RunSettings = { terminationTimeoutMs?: number, }; +/** RunStarted data exchanged with the IDE (API 1.21). */ +export type RunStarted = { + id: string, + config: string, + debug: boolean, +}; + /** * Build, Execution, Deployment › Run Targets: run configurations on another machine * or in a container. @@ -18649,16 +18679,28 @@ export type WindowRequest = WindowRequest_Serialize | WindowRequest_Deserialize; /** A request that the invoking window acknowledges through plugin_answer_command. */ export type WindowRequest_Deserialize = /** Connect and introspect using the normal Database action in this window. */ -({ kind: "databaseConnect"; id: string }) & { args?: never; config?: never; cwd?: never; debug?: never; env?: never; key?: never; operation?: never; program?: never; tab?: never; title?: never } | +({ kind: "databaseConnect"; id: string }) & { args?: never; config?: never; configId?: never; cwd?: never; debug?: never; draft?: never; env?: never; key?: never; operation?: never; program?: never; tab?: never; title?: never } | /** Open and acknowledge validation by the shared content editor. */ -({ kind: "contentTab"; tab: ContentTab }) & { args?: never; config?: never; cwd?: never; debug?: never; env?: never; id?: never; key?: never; operation?: never; program?: never; title?: never } | ({ kind: "run"; operation: string; config: RunConfig_Deserialize; debug: boolean }) & { args?: never; cwd?: never; env?: never; id?: never; key?: never; program?: never; tab?: never; title?: never } | ({ kind: "terminal"; operation: string; key: string; title: string; program: IpcPath; args: string[]; env: { [key in string]: string }; cwd: IpcPath }) & { config?: never; debug?: never; id?: never; tab?: never }; +({ kind: "contentTab"; tab: ContentTab }) & { args?: never; config?: never; configId?: never; cwd?: never; debug?: never; draft?: never; env?: never; id?: never; key?: never; operation?: never; program?: never; title?: never } | ({ kind: "run"; operation: string; config: RunConfig_Deserialize; debug: boolean }) & { args?: never; configId?: never; cwd?: never; draft?: never; env?: never; id?: never; key?: never; program?: never; tab?: never; title?: never } | ({ kind: "terminal"; operation: string; key: string; title: string; program: IpcPath; args: string[]; env: { [key in string]: string }; cwd: IpcPath }) & { config?: never; configId?: never; debug?: never; draft?: never; id?: never; tab?: never } | +/** Stop an active run/debug session belonging to this plugin (API 1.21). */ +({ kind: "stopRun"; id: string }) & { args?: never; config?: never; configId?: never; cwd?: never; debug?: never; draft?: never; env?: never; key?: never; operation?: never; program?: never; tab?: never; title?: never } | +/** Create or update a saved run configuration for one of this plugin's own types (API 1.21). */ +({ kind: "upsertRunConfiguration"; draft: RunConfigDraft }) & { args?: never; config?: never; configId?: never; cwd?: never; debug?: never; env?: never; id?: never; key?: never; operation?: never; program?: never; tab?: never; title?: never } | +/** Open Run/Debug Configurations dialog, optionally selecting `config_id` (API 1.21). */ +({ kind: "openEditConfigurations"; configId: string | null }) & { args?: never; config?: never; cwd?: never; debug?: never; draft?: never; env?: never; id?: never; key?: never; operation?: never; program?: never; tab?: never; title?: never }; /** A request that the invoking window acknowledges through plugin_answer_command. */ export type WindowRequest_Serialize = /** Connect and introspect using the normal Database action in this window. */ -({ kind: "databaseConnect"; id: string }) & { args?: never; config?: never; cwd?: never; debug?: never; env?: never; key?: never; operation?: never; program?: never; tab?: never; title?: never } | +({ kind: "databaseConnect"; id: string }) & { args?: never; config?: never; configId?: never; cwd?: never; debug?: never; draft?: never; env?: never; key?: never; operation?: never; program?: never; tab?: never; title?: never } | /** Open and acknowledge validation by the shared content editor. */ -({ kind: "contentTab"; tab: ContentTab }) & { args?: never; config?: never; cwd?: never; debug?: never; env?: never; id?: never; key?: never; operation?: never; program?: never; title?: never } | ({ kind: "run"; operation: string; config: RunConfig_Serialize; debug: boolean }) & { args?: never; cwd?: never; env?: never; id?: never; key?: never; program?: never; tab?: never; title?: never } | ({ kind: "terminal"; operation: string; key: string; title: string; program: IpcPath; args: string[]; env: { [key in string]: string }; cwd: IpcPath }) & { config?: never; debug?: never; id?: never; tab?: never }; +({ kind: "contentTab"; tab: ContentTab }) & { args?: never; config?: never; configId?: never; cwd?: never; debug?: never; draft?: never; env?: never; id?: never; key?: never; operation?: never; program?: never; title?: never } | ({ kind: "run"; operation: string; config: RunConfig_Serialize; debug: boolean }) & { args?: never; configId?: never; cwd?: never; draft?: never; env?: never; id?: never; key?: never; program?: never; tab?: never; title?: never } | ({ kind: "terminal"; operation: string; key: string; title: string; program: IpcPath; args: string[]; env: { [key in string]: string }; cwd: IpcPath }) & { config?: never; configId?: never; debug?: never; draft?: never; id?: never; tab?: never } | +/** Stop an active run/debug session belonging to this plugin (API 1.21). */ +({ kind: "stopRun"; id: string }) & { args?: never; config?: never; configId?: never; cwd?: never; debug?: never; draft?: never; env?: never; key?: never; operation?: never; program?: never; tab?: never; title?: never } | +/** Create or update a saved run configuration for one of this plugin's own types (API 1.21). */ +({ kind: "upsertRunConfiguration"; draft: RunConfigDraft }) & { args?: never; config?: never; configId?: never; cwd?: never; debug?: never; env?: never; id?: never; key?: never; operation?: never; program?: never; tab?: never; title?: never } | +/** Open Run/Debug Configurations dialog, optionally selecting `config_id` (API 1.21). */ +({ kind: "openEditConfigurations"; configId: string | null }) & { args?: never; config?: never; cwd?: never; debug?: never; draft?: never; env?: never; id?: never; key?: never; operation?: never; program?: never; tab?: never; title?: never }; export type WindowTab = WindowTab_Serialize | WindowTab_Deserialize; @@ -18679,7 +18721,7 @@ export type WindowTab_Serialize = { }; /** A workbench event delivered to plugins. */ -export type WorkbenchEvent = { kind: "documentChanged"; value: DocumentChanged } | { kind: "websocketReady"; value: WebsocketReady } | { kind: "runExited"; value: RunExited } | { kind: "terminalExited"; value: TerminalExited } | { kind: "contentTabAction"; value: ContentTabAction } | { kind: "fileClosed"; value: string } | { kind: "settingsChanged"; value: string[] } | +export type WorkbenchEvent = { kind: "documentChanged"; value: DocumentChanged } | { kind: "websocketReady"; value: WebsocketReady } | { kind: "runStarted"; value: RunStarted } | { kind: "runExited"; value: RunExited } | { kind: "terminalExited"; value: TerminalExited } | { kind: "contentTabAction"; value: ContentTabAction } | { kind: "fileClosed"; value: string } | { kind: "settingsChanged"; value: string[] } | /** Ids of extension points the receiving plugin declares whose contributions changed. */ { kind: "extensionsChanged"; value: string[] } | { kind: "inputModeChanged"; value: InputMode } | { kind: "fileOpened"; value: string } | { kind: "fileSaved"; value: string } | { kind: "filesChanged"; value: FilesChanged } | { kind: "editorFocused"; value: string | null } | { kind: "caretMoved"; value: CaretMoved } | { kind: "actionPerformed"; value: ActionPerformed } | { kind: "vcsChanged"; value: string } | /** Problems of the window's files changed; plugins re-read `problems`. */ diff --git a/src/features/debugger/ui/DebugToolWindow.tsx b/src/features/debugger/ui/DebugToolWindow.tsx index 026652b7dc..7b281fc2d0 100644 --- a/src/features/debugger/ui/DebugToolWindow.tsx +++ b/src/features/debugger/ui/DebugToolWindow.tsx @@ -51,6 +51,7 @@ import { useDebug, type DebugSession, } from "../state"; +import { ContributedToolbar } from "@/workbench/ContributedToolbar"; import { remoteWaitingNote } from "../remote"; import { sessionTabs } from "./sessionTabs"; import { debugTabMenu } from "../tabActions"; @@ -348,6 +349,24 @@ function DebugView({ consolePane, sideDocked = false }: { consolePane?: ReactNod className={styles.tool} onClick={() => setMuted(!muted)} /> + {rootSession?.runConfig && ( + <ContributedToolbar + slot="runConsole.toolbar" + whenContext={{ + runConfigKind: rootSession.runConfig.kind, + runConfigId: rootSession.runConfig.id, + runActive: isLive(rootSession), + runDebug: true, + }} + defaultArg={JSON.stringify({ + id: rootSession.process !== null ? String(rootSession.process) : rootSession.id, + configId: rootSession.runConfig.id, + kind: rootSession.runConfig.kind, + running: isLive(rootSession), + debug: true, + })} + /> + )} <MoreActions /> </Toolbar> <div role="tablist" aria-label={tx("Debug views")} className={styles.tabs}> diff --git a/src/features/plugins/__tests__/runConfigForm.test.tsx b/src/features/plugins/__tests__/runConfigForm.test.tsx index d61a436f2f..0ed9784c31 100644 --- a/src/features/plugins/__tests__/runConfigForm.test.tsx +++ b/src/features/plugins/__tests__/runConfigForm.test.tsx @@ -5,7 +5,14 @@ import type { RunConfig } from "@/platform/ipc"; import { resetRuns, useRun } from "@/features/run/store"; import { EditConfigsOverlay } from "@/features/run/EditConfigsDialog"; import { typeForConfig } from "@/features/run/types"; -import { useRunConfigTypes } from "@/workbench/contributions"; +import { ContributedToolbar } from "@/workbench/ContributedToolbar"; +import { + registerMenuSlotItem, + useRunConfigTypes, + parsePluginJavaDebug, + parsePluginLogFiles, +} from "@/workbench/contributions"; +import { registerActions } from "@/platform/actions"; import { createMemoryPluginsBackend, setPluginsBackend } from "../backend"; import { usePlugins } from "../store"; import { FRAME_TAG, frameDocument } from "../views/frame"; @@ -308,4 +315,103 @@ describe("plugin runConfigTypes integration", () => { dispose(); }); + + it("supports API 1.21 mode, loopback javaDebug, logFiles, ownsBeforeLaunch, and runConsole.toolbar", async () => { + // applyRunConfigPatch validates loopback javaDebug & logFiles. + const base = baseConfig(); + expect(() => applyRunConfigPatch(base, { javaDebug: { host: "example.com", port: 8000 } }, true)).toThrow( + /loopback/, + ); + const patched = applyRunConfigPatch( + base, + { + javaDebug: { host: "127.0.0.1", port: 5005, timeoutMs: 5000 }, + logFiles: [{ id: "catalina", title: "Catalina Log", path: "logs/catalina.out" }], + }, + true, + ); + expect(parsePluginJavaDebug(patched)).toEqual({ host: "127.0.0.1", port: 5005, timeoutMs: 5000 }); + expect(parsePluginLogFiles(patched)).toEqual([ + { id: "catalina", title: "Catalina Log", path: "logs/catalina.out" }, + ]); + + // prepareCommand receives mode: "debug". + const runCommand = vi.fn(async (_pluginId: string, _command: string, _arg: string | null) => + JSON.stringify({ javaDebug: { host: "localhost", port: 8787 } }), + ); + setPluginsBackend({ + ...createMemoryPluginsBackend([]), + webPageUrl: async () => "about:blank", + runCommand, + }); + usePlugins.setState({ + plugins: [{ id: "acme.tomcat", hasCode: true, capabilities: [] } as unknown as PluginInfo], + }); + const dispose = projectRunConfigType("acme.tomcat", { + id: "tomcat-pro", + label: "SmartTomcat Pro", + web: "web/form.html", + ownsBeforeLaunch: true, + prepareCommand: "prepare", + }); + const kind = pluginRunConfigKind("acme.tomcat", "tomcat-pro"); + const prepared = await useRunConfigTypes.getState().types.get(kind)!.prepareLaunch!( + baseConfig({ kind, beforeLaunch: [] }), + { mode: "debug" }, + ); + const sentSnap = JSON.parse(runCommand.mock.calls[0]![2] as string) as { mode?: string }; + expect(sentSnap.mode).toBe("debug"); + expect(parsePluginJavaDebug(prepared)).toEqual({ host: "localhost", port: 8787 }); + expect(prepared.params?.__pluginDebug).toBe("1"); + + // ownsBeforeLaunch hides the built-in Before launch editor. + const cfg = baseConfig({ id: "user:pro", kind, command: "java", beforeLaunch: [{ kind: "build" } as never] }); + useRun.setState({ configs: [cfg], editorOpen: true, editTarget: cfg.id }); + render(<EditConfigsOverlay />); + await waitFor(() => expect(document.querySelector("iframe")).not.toBeNull()); + expect(screen.queryByText("Before launch")).toBeNull(); + + // runConsole.toolbar ContributedToolbar filters by whenContext and uses defaultArg. + const ran: unknown[] = []; + const offAction = registerActions([ + { + id: "plugin.acme.tomcat.redeploy", + title: "Redeploy", + icon: "rerun", + run: ({ arg }) => { + ran.push(arg); + }, + }, + ]); + const offSlot = registerMenuSlotItem("runConsole.toolbar", { + action: "plugin.acme.tomcat.redeploy", + label: "Redeploy", + icon: "rerun", + when: `runConfigKind == "${kind}" && runActive`, + }); + const payload = JSON.stringify({ id: "42", configId: cfg.id, kind, running: true, debug: false }); + const { rerender } = render( + <ContributedToolbar + slot="runConsole.toolbar" + whenContext={{ runConfigKind: kind, runConfigId: cfg.id, runActive: true, runDebug: false }} + defaultArg={payload} + />, + ); + const btn = screen.getByRole("button", { name: "Redeploy" }); + fireEvent.click(btn); + expect(ran).toEqual([payload]); + + rerender( + <ContributedToolbar + slot="runConsole.toolbar" + whenContext={{ runConfigKind: "other", runConfigId: cfg.id, runActive: true, runDebug: false }} + defaultArg={payload} + />, + ); + expect(screen.queryByRole("button", { name: "Redeploy" })).toBeNull(); + + offSlot(); + offAction(); + dispose(); + }); }); diff --git a/src/features/plugins/runtimeUi.tsx b/src/features/plugins/runtimeUi.tsx index c29d9a2d77..8443f12067 100644 --- a/src/features/plugins/runtimeUi.tsx +++ b/src/features/plugins/runtimeUi.tsx @@ -921,6 +921,31 @@ async function handleWindowRequest(e: Extract<PluginEvent, { type: "windowReques await pluginsBackend().answerCommand(e.requestId, { kind: "value", value: null }); return; } + if (r.kind === "stopRun") { + if (!getAction("run.pluginStop")) throw new Error("Run service unavailable"); + await executeActionOrThrow("run.pluginStop", { id: r.id }); + if (e.requestId) await pluginsBackend().answerCommand(e.requestId, { kind: "value", value: null }); + return; + } + if (r.kind === "upsertRunConfiguration") { + if (!getAction("run.pluginUpsert")) throw new Error("Run service unavailable"); + let savedId = ""; + await executeActionOrThrow("run.pluginUpsert", { + pluginId: e.pluginId, + draft: r.draft, + onSaved: (id: string) => { + savedId = id; + }, + }); + if (e.requestId) await pluginsBackend().answerCommand(e.requestId, { kind: "value", value: savedId }); + return; + } + if (r.kind === "openEditConfigurations") { + if (!getAction("run.editConfigs")) throw new Error("Run service unavailable"); + await executeActionOrThrow("run.editConfigs", r.configId ?? undefined); + if (e.requestId) await pluginsBackend().answerCommand(e.requestId, { kind: "value", value: null }); + return; + } const finish = (status: number | null, stopped: boolean) => { if (r.kind === "run") void pluginsBackend().finishOperation(r.operation, status, stopped); else if (stopped) void pluginsBackend().closeTerminalSession(r.operation); diff --git a/src/features/plugins/uiPoints.tsx b/src/features/plugins/uiPoints.tsx index add8422672..1cc0124d46 100644 --- a/src/features/plugins/uiPoints.tsx +++ b/src/features/plugins/uiPoints.tsx @@ -102,7 +102,8 @@ interface MenuDecl { | "services.context" | "services.toolbar" | "database.table.context" - | "openIn"; + | "openIn" + | "runConsole.toolbar"; view?: string | null; command: string; when?: string | null; @@ -298,7 +299,12 @@ function projectMenu(pluginId: string, decl: MenuDecl, plugin: PluginInfo): () = const title = decl.commandTitle ?? getAction(action)?.title ?? `${plugin.name}: ${decl.command}`; return registerMenuSlotItem("pluginTools", { action, label: title, verbatim: true }); } - if (decl.menu === "commit.message" || decl.menu === "editor.title" || decl.menu === "mainToolbar") { + if ( + decl.menu === "commit.message" || + decl.menu === "editor.title" || + decl.menu === "mainToolbar" || + decl.menu === "runConsole.toolbar" + ) { const action = pluginActionId(pluginId, decl.command); const label = getAction(action)?.title ?? `${plugin.name}: ${decl.command}`; return registerMenuSlotItem(decl.menu === "commit.message" ? "commitMessage" : decl.menu, { diff --git a/src/features/plugins/views/runConfigForm.tsx b/src/features/plugins/views/runConfigForm.tsx index 273033fd19..05a9ec0b46 100644 --- a/src/features/plugins/views/runConfigForm.tsx +++ b/src/features/plugins/views/runConfigForm.tsx @@ -3,6 +3,10 @@ import type { RunConfig } from "@/platform/ipc"; import { useProject } from "@/platform/project"; import { registerExternalIcons } from "@/ui"; import { + PLUGIN_DEBUG_PARAM, + PLUGIN_JAVA_DEBUG_PARAM, + PLUGIN_LOG_FILES_PARAM, + isLoopbackHost, registerRunConfigType, type RunConfigFormProps, type RunConfigTypeContribution, @@ -31,6 +35,7 @@ export interface RunConfigTypeDecl { terminal?: boolean | null; ownsWorkingDirectory?: boolean; ownsEnvironment?: boolean; + ownsBeforeLaunch?: boolean; prepareCommand?: string | null; matchConfigPrefix?: string | null; defaults?: Record<string, string>; @@ -54,6 +59,7 @@ export interface RunConfigFormSnapshot { detected: boolean; template: boolean; projectRoot: string | null; + mode?: "run" | "debug"; } export function pluginRunConfigKind(pluginId: string, typeId: string): string { @@ -65,6 +71,7 @@ export function runConfigSnapshot( typeId: string, template: boolean, projectRoot: string | null, + mode?: "run" | "debug", ): RunConfigFormSnapshot { return { id: config.id, @@ -84,6 +91,7 @@ export function runConfigSnapshot( detected: config.detected, template, projectRoot, + ...(mode ? { mode } : {}), }; } @@ -177,6 +185,63 @@ export function applyRunConfigPatch(config: RunConfig, rawPatch: unknown, templa next.stopCommand = stop.trim() ? stop : null; } } + if ("javaDebug" in rawPatch) { + const params: Record<string, string> = { ...(next.params ?? {}) }; + if (rawPatch.javaDebug === null || rawPatch.javaDebug === undefined) { + delete params[PLUGIN_JAVA_DEBUG_PARAM]; + } else { + if (!isPlainObject(rawPatch.javaDebug)) throw new Error("javaDebug must be an object"); + const hostRaw = + rawPatch.javaDebug.host === undefined + ? "127.0.0.1" + : requireText(rawPatch.javaDebug.host, "javaDebug.host", 128, true); + if (!isLoopbackHost(hostRaw)) { + throw new Error("javaDebug.host must be a loopback address (127.0.0.1, localhost, or ::1)"); + } + const javaDebug: { host: string; port?: number; timeoutMs?: number } = { host: hostRaw.trim() }; + if (rawPatch.javaDebug.port !== undefined) { + const port = rawPatch.javaDebug.port; + if (typeof port !== "number" || !Number.isInteger(port) || port < 1 || port > 65535) { + throw new Error("javaDebug.port must be an integer between 1 and 65535"); + } + javaDebug.port = port; + } + if (rawPatch.javaDebug.timeoutMs !== undefined) { + const timeoutMs = rawPatch.javaDebug.timeoutMs; + if (typeof timeoutMs !== "number" || !Number.isInteger(timeoutMs) || timeoutMs < 1000 || timeoutMs > 60000) { + throw new Error("javaDebug.timeoutMs must be an integer between 1000 and 60000"); + } + javaDebug.timeoutMs = timeoutMs; + } + params[PLUGIN_JAVA_DEBUG_PARAM] = JSON.stringify(javaDebug); + } + next.params = params; + } + if ("logFiles" in rawPatch) { + const params: Record<string, string> = { ...(next.params ?? {}) }; + if (rawPatch.logFiles === null || rawPatch.logFiles === undefined) { + delete params[PLUGIN_LOG_FILES_PARAM]; + } else { + if (!Array.isArray(rawPatch.logFiles) || rawPatch.logFiles.length > 8) { + throw new Error("logFiles must be an array of at most 8 entries"); + } + const normalized = rawPatch.logFiles.map((entry, idx) => { + if (!isPlainObject(entry)) throw new Error(`logFiles[${idx}] must be an object`); + const title = requireText(entry.title, `logFiles[${idx}].title`, 128, true).trim(); + if (!title) throw new Error(`logFiles[${idx}].title must not be empty`); + const path = requireText(entry.path, `logFiles[${idx}].path`, 4096, true).trim(); + if (!path) throw new Error(`logFiles[${idx}].path must not be empty`); + const id = + entry.id !== undefined + ? requireText(entry.id, `logFiles[${idx}].id`, 128, true).trim() || `log-${idx}` + : `log-${idx}`; + return { id, title, path }; + }); + if (normalized.length) params[PLUGIN_LOG_FILES_PARAM] = JSON.stringify(normalized); + else delete params[PLUGIN_LOG_FILES_PARAM]; + } + next.params = params; + } return next; } @@ -290,15 +355,17 @@ export function projectRunConfigType(pluginId: string, decl: RunConfigTypeDecl): customFormLayout: decl.layout === "full" ? "full" : "embedded", ownsWorkingDirectory: decl.ownsWorkingDirectory || undefined, ownsEnvironment: decl.ownsEnvironment || undefined, + ownsBeforeLaunch: decl.ownsBeforeLaunch || undefined, commandOptional: !!decl.prepareCommand, terminal: decl.terminal ?? undefined, debugAdapter: decl.debugAdapter ?? undefined, commandLine: () => (decl.command ? { command: decl.command, args: [...(decl.args ?? [])] } : null), matches: matchPrefix !== null ? (c) => c.kind === "plugin" && c.id.startsWith(matchPrefix) : undefined, prepareLaunch: decl.prepareCommand - ? async (config) => { + ? async (config, options) => { + const mode = options?.mode ?? "run"; const projectRoot = useProject.getState().project?.root ?? null; - const snap = runConfigSnapshot(config, decl.id, false, projectRoot); + const snap = runConfigSnapshot(config, decl.id, false, projectRoot, mode); const reply = await pluginsBackend().runCommand( pluginId, decl.prepareCommand!, @@ -306,14 +373,20 @@ export function projectRunConfigType(pluginId: string, decl: RunConfigTypeDecl): null, [], ); - if (!reply?.trim()) return config; - let parsed: unknown; - try { - parsed = JSON.parse(reply); - } catch { - throw new Error(`Invalid launch configuration returned by '${decl.prepareCommand}'`); + let next = config; + if (reply?.trim()) { + let parsed: unknown; + try { + parsed = JSON.parse(reply); + } catch { + throw new Error(`Invalid launch configuration returned by '${decl.prepareCommand}'`); + } + next = applyRunConfigPatch(config, parsed, true); } - return applyRunConfigPatch(config, parsed, true); + if (mode === "debug") { + next = { ...next, params: { ...(next.params ?? {}), [PLUGIN_DEBUG_PARAM]: "1" } }; + } + return next; } : undefined, }; diff --git a/src/features/run/ConfigForm.tsx b/src/features/run/ConfigForm.tsx index 8994e3d57b..3b3aababc9 100644 --- a/src/features/run/ConfigForm.tsx +++ b/src/features/run/ConfigForm.tsx @@ -403,6 +403,7 @@ export function ConfigForm({ .filter( (id) => (!compound || id === "beforeLaunch") && + (id !== "beforeLaunch" || !type?.ownsBeforeLaunch) && (id !== "emulateTerminal" || terminal || !!config.emulateTerminal) && (id !== "buildPolicy" || buildPolicyApplies(config)) && (id !== "watch" || watchApplies), @@ -762,7 +763,7 @@ export function ConfigForm({ </Field> )} - {isShown("beforeLaunch") && ( + {isShown("beforeLaunch") && !type?.ownsBeforeLaunch && ( <Field label="Before launch" error={errors.beforeLaunch} top> <BeforeLaunchTasks config={config} diff --git a/src/features/run/RunView.tsx b/src/features/run/RunView.tsx index 86a6c9bbb4..011f6f13da 100644 --- a/src/features/run/RunView.tsx +++ b/src/features/run/RunView.tsx @@ -1,7 +1,7 @@ import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react"; import clsx from "clsx"; import type { GroupImperativeHandle, Layout } from "react-resizable-panels"; -import type { RunConfig } from "@/platform/ipc"; +import { call, commands, isTauri, type RunConfig } from "@/platform/ipc"; import type { RunTargetValid } from "@/platform/remoteSettings"; import { setConsoleSoftWrap, useAgentRunSettings, useWorkflowSettings } from "@/platform/workflowSettings"; import { @@ -67,7 +67,8 @@ import { agentName } from "./agentConfig"; import { archivedAgentSessions, closeAgentArchive } from "./agentRuns"; import styles from "./Run.module.css"; import { tx } from "@/platform/i18n"; -import { SERVICES_WINDOW } from "@/workbench/contributions"; +import { SERVICES_WINDOW, parsePluginLogFiles, pluginOwnerFromConfig } from "@/workbench/contributions"; +import { ContributedToolbar } from "@/workbench/ContributedToolbar"; import { TomcatSessionPanel } from "./TomcatSessionPanel"; const TEST_SPLIT_DEFAULTS = { @@ -115,6 +116,12 @@ function DefaultSessionPanel({ session, showLifecycle = true }: { session: RunSe const softWrap = useWorkflowSettings((s) => s.console.softWrap); const [selectedTest, setSelectedTest] = useState<string | null>(null); const [findOpen, setFindOpen] = useState(false); + const [logTabBySession, setLogTabBySession] = useState<{ sessionId: RunSession["id"]; tab: string }>({ + sessionId: session.id, + tab: "console", + }); + const selectedLogTab = logTabBySession.sessionId === session.id ? logTabBySession.tab : "console"; + const setSelectedLogTab = (tab: string) => setLogTabBySession({ sessionId: session.id, tab }); const body = useRef<HTMLDivElement>(null); const moreButton = useRef<HTMLButtonElement>(null); const [moreOpen, setMoreOpen] = useState(false); @@ -191,6 +198,9 @@ function DefaultSessionPanel({ session, showLifecycle = true }: { session: RunSe return m; }, [selectedTest, rt, version]); // eslint-disable-line react-hooks/exhaustive-deps + const logFiles = useMemo(() => parsePluginLogFiles(session.config), [session.config]); + const logOwner = useMemo(() => pluginOwnerFromConfig(session.config), [session.config]); + if (!rt) return null; const overflowConsoleToggles = showLifecycle && compactToolbar && !rt.terminal; const consoleToggles = [ @@ -220,63 +230,100 @@ function DefaultSessionPanel({ session, showLifecycle = true }: { session: RunSe /> ); + const activeLogFile = + selectedLogTab !== "console" && logOwner ? (logFiles.find((f) => f.id === selectedLogTab) ?? null) : null; + const consoleColumn = ( <div className={styles.consoleColumn}> - {rt.tests && <TestStatusBar results={rt.tests} version={version} running={testsRunning} />} - {rt.console.dropped > 0 && !testModel && ( - <div className={styles.notice}>{tx`${rt.console.dropped.toLocaleString()} earlier lines were discarded`}</div> - )} - {testModel && ( - <div className={styles.notice}> - <button type="button" className={styles.noticeLink} onClick={() => setSelectedTest(null)}> - <T>Show all output</T> - </button> - {selectedTest && canUpdateSnapshots(session.id, [selectedTest]) && ( - <button - type="button" - className={styles.noticeLink} - onClick={() => void updateSnapshots(session.id, [selectedTest])} - > - <T>Update Snapshot</T> - </button> - )} - </div> - )} - {rt.terminal && !testModel ? ( - <TerminalConsole - output={rt.terminal} - cwd={cwd} - onData={(data) => writeTerminal(session.id, data)} - onResize={(cols, rows) => resizeTerminal(session.id, cols, rows)} - aria-label={tx`${session.config.name} terminal`} + {logOwner && logFiles.length > 0 && ( + <Tabs + variant="compact" + aria-label={tx("Console")} + items={[ + { id: "console", label: tx("Console") }, + ...logFiles.map((f) => ({ id: f.id, label: f.title, verbatim: true })), + ]} + activeId={activeLogFile ? activeLogFile.id : "console"} + onSelect={setSelectedLogTab} /> - ) : ( - <ConsoleView - model={testModel ?? rt.console} - version={version} + )} + {activeLogFile && logOwner ? ( + <PluginLogTailPane + key={`${session.id}:${activeLogFile.id}:${activeLogFile.path}`} + pluginId={logOwner} + path={activeLogFile.path} + title={activeLogFile.title} + running={running} softWrap={softWrap} - follow={testModel ? false : follow} + follow={follow} onFollowChange={setFollow} findOpen={findOpen} onFindOpenChange={setFindOpen} cwd={cwd} module={session.config.module} container={container} - onClear={() => clearConsole(session.id)} - // A test run's Previous / Next Occurrence go through its failed tests. - occurrences={rt.tests ? undefined : showLifecycle ? "run" : SERVICES_WINDOW} - input={ - !testModel && acceptsInput(session) - ? { - pending: rt.input, - onChange: (text) => setPendingInput(session.id, text), - onSubmit: (line) => void sendStdin(session.id, line), - onEof: () => void closeStdin(session.id), - } - : undefined - } - aria-label={tx`${session.config.name} output`} /> + ) : ( + <> + {rt.tests && <TestStatusBar results={rt.tests} version={version} running={testsRunning} />} + {rt.console.dropped > 0 && !testModel && ( + <div + className={styles.notice} + >{tx`${rt.console.dropped.toLocaleString()} earlier lines were discarded`}</div> + )} + {testModel && ( + <div className={styles.notice}> + <button type="button" className={styles.noticeLink} onClick={() => setSelectedTest(null)}> + <T>Show all output</T> + </button> + {selectedTest && canUpdateSnapshots(session.id, [selectedTest]) && ( + <button + type="button" + className={styles.noticeLink} + onClick={() => void updateSnapshots(session.id, [selectedTest])} + > + <T>Update Snapshot</T> + </button> + )} + </div> + )} + {rt.terminal && !testModel ? ( + <TerminalConsole + output={rt.terminal} + cwd={cwd} + onData={(data) => writeTerminal(session.id, data)} + onResize={(cols, rows) => resizeTerminal(session.id, cols, rows)} + aria-label={tx`${session.config.name} terminal`} + /> + ) : ( + <ConsoleView + model={testModel ?? rt.console} + version={version} + softWrap={softWrap} + follow={testModel ? false : follow} + onFollowChange={setFollow} + findOpen={findOpen} + onFindOpenChange={setFindOpen} + cwd={cwd} + module={session.config.module} + container={container} + onClear={() => clearConsole(session.id)} + // A test run's Previous / Next Occurrence go through its failed tests. + occurrences={rt.tests ? undefined : showLifecycle ? "run" : SERVICES_WINDOW} + input={ + !testModel && acceptsInput(session) + ? { + pending: rt.input, + onChange: (text) => setPendingInput(session.id, text), + onSubmit: (line) => void sendStdin(session.id, line), + onEof: () => void closeStdin(session.id), + } + : undefined + } + aria-label={tx`${session.config.name} output`} + /> + )} + </> )} </div> ); @@ -377,6 +424,22 @@ function DefaultSessionPanel({ session, showLifecycle = true }: { session: RunSe </> )} <IconButton icon="trash" title="Clear All" onClick={() => clearConsole(session.id)} /> + <ContributedToolbar + slot="runConsole.toolbar" + whenContext={{ + runConfigKind: session.config.kind, + runConfigId: session.config.id, + runActive: running, + runDebug: false, + }} + defaultArg={JSON.stringify({ + id: session.runId !== null ? String(session.runId) : session.id, + configId: session.config.id, + kind: session.config.kind, + running, + debug: false, + })} + /> </div> <div className={styles.toolbarGroup}> {showLifecycle ? ( @@ -635,3 +698,97 @@ export function RunView() { </div> ); } + +function PluginLogTailPane({ + pluginId, + path, + title, + running, + softWrap, + follow, + onFollowChange, + findOpen, + onFindOpenChange, + cwd, + module, + container, +}: { + pluginId: string; + path: string; + title: string; + running: boolean; + softWrap: boolean; + follow: boolean; + onFollowChange: (v: boolean) => void; + findOpen: boolean; + onFindOpenChange: (v: boolean) => void; + cwd: string; + module?: string | null; + container?: string | null; +}) { + const model = useMemo(() => new ConsoleModel(), []); + const [version, setVersion] = useState(0); + const [exists, setExists] = useState(true); + const [error, setError] = useState<string | null>(null); + const offsetRef = useRef(0); + + useEffect(() => { + let cancelled = false; + const poll = async () => { + if (!isTauri()) return; + try { + const chunk = await call(commands.pluginRunLogTail(pluginId, path, offsetRef.current, null)); + if (cancelled) return; + setError(null); + setExists(chunk.exists); + offsetRef.current = Number(chunk.offset); + if (chunk.truncated) { + model.clear(); + } + if (chunk.content) { + model.append({ kind: "stdout", text: chunk.content }); + } + if (chunk.truncated || chunk.content) { + setVersion((v) => v + 1); + } + } catch (e) { + if (!cancelled) setError(e instanceof Error ? e.message : String(e)); + } + }; + void poll(); + if (!running) + return () => { + cancelled = true; + }; + const timer = setInterval(() => void poll(), 1200); + return () => { + cancelled = true; + clearInterval(timer); + }; + }, [pluginId, path, running, model]); + + return ( + <> + {error && <div className={styles.notice}>{error}</div>} + {!error && !exists && <div className={styles.notice}>{tx("Waiting for output…")}</div>} + <ConsoleView + model={model} + version={version} + softWrap={softWrap} + follow={follow} + onFollowChange={onFollowChange} + findOpen={findOpen} + onFindOpenChange={onFindOpenChange} + cwd={cwd} + module={module} + container={container} + onClear={() => { + model.clear(); + setVersion((v) => v + 1); + }} + occurrences="run" + aria-label={title} + /> + </> + ); +} diff --git a/src/features/run/index.ts b/src/features/run/index.ts index 41ddadacfe..1d844a5024 100644 --- a/src/features/run/index.ts +++ b/src/features/run/index.ts @@ -15,6 +15,7 @@ import { agentRunSettings, onWorkflowSettingsChange } from "@/platform/workflowS import { showContextMenu, lazyComponent, lazyWhen, type MenuItem } from "@/ui"; import { menuGroupItems, + parsePluginJavaDebug, useDebugRunSessions, notifications, provideRunConfigurationChecks, @@ -45,7 +46,7 @@ import { } from "./contextRun"; import { runWithExecutor } from "./executors"; import { notifyCwdError, withExpandedCwd } from "./cwdMacros"; -import { debugWithAgent, jdwpLaunch } from "./javaDebug"; +import { debugPluginJava, debugWithAgent, jdwpLaunch } from "./javaDebug"; import { debugXcodeApp } from "./xcodeDebug"; import { attachesToChild, debugAttachingToChild } from "./pluginAttach"; import { RunDialogsOverlay } from "./dialogs"; @@ -224,7 +225,7 @@ async function debugLaunch(config: RunConfig, chain: readonly string[], show?: b let typePrepared = false; if (typePrepare && (config.kind.startsWith("plugin:") || typeForConfig(config)?.matches)) { try { - config = await typePrepare(config); + config = await typePrepare(config, { mode: "debug" }); typePrepared = true; } catch (error) { notifications().notify({ @@ -247,6 +248,11 @@ async function debugLaunch(config: RunConfig, chain: readonly string[], show?: b await debugOnTarget(config); return; } + // A plugin configuration declaring a loopback JDWP attach target (API 1.21). + if (parsePluginJavaDebug(config) && getAction("debug.attach")) { + await debugPluginJava(config, { origin: originalConfig, show, prepared: true, typePrepared }); + return; + } // A plugin configuration whose debugger attaches to a process the run starts. if (attachesToChild(config) && getAction("debug.attach")) { await debugAttachingToChild(config, { show, prepared: true, typePrepared }); @@ -1045,6 +1051,13 @@ export function activate(): () => void { debug: boolean; onExit: (code: number | null, stopped: boolean) => void; }; + if (a.debug && parsePluginJavaDebug(a.config)) { + if (!getAction("debug.attach")) throw new Error("Debugger unavailable"); + const session = await debugPluginJava(a.config, { onExit: a.onExit }); + if (!session || session.status === "failed") throw new Error("Run did not start"); + if (session.runId === null && session.status === "finished") a.onExit(session.exitCode, !!session.stopped); + return; + } if (a.debug && attachesToChild(a.config)) { if (!getAction("debug.attach")) throw new Error("Debugger unavailable"); const session = await debugAttachingToChild(a.config, { onExit: a.onExit }); @@ -1062,6 +1075,105 @@ export function activate(): () => void { if (session.runId === null && session.status === "finished") a.onExit(session.exitCode, !!session.stopped); }, }, + { + id: "run.pluginStop", + title: "Stop Plugin Run", + category: "Run", + hidden: true, + when: "projectOpen", + run: async ({ arg }) => { + const { id } = (arg ?? {}) as { id?: string }; + if (!id) throw new Error("Missing run id"); + const runSession = useRun + .getState() + .sessions.find((s) => String(s.runId) === id || s.config.params?.["plugin.operation"] === id); + if (runSession) { + await stopSession(runSession.id); + return; + } + const dbg = useDebugRunSessions + .getState() + .serviceSessions.find((d) => String(d.processId) === id && d.status !== "terminated"); + if (dbg) { + await dbg.stop(); + return; + } + throw new Error(`No active run '${id}'`); + }, + }, + { + id: "run.pluginUpsert", + title: "Save Plugin Run Configuration", + category: "Run", + hidden: true, + when: "projectOpen", + run: async ({ arg }) => { + const a = (arg ?? {}) as { + pluginId?: string; + draft?: { + id: string | null; + typeId: string; + name: string; + command: string | null; + args: string[]; + cwd: string | null; + env: [string, string][]; + params: [string, string][]; + allowParallel: boolean; + }; + onSaved?: (id: string) => void; + }; + if (!a.pluginId || !a.draft) throw new Error("Missing run configuration draft"); + await ensureConfigs(); + const kind = `plugin:${a.pluginId}:${a.draft.typeId}`; + const existingAll = useRun.getState().configs; + const userConfigs = existingAll.filter((c) => !c.detected); + let id = a.draft.id?.trim() || ""; + if (id) { + const match = existingAll.find((c) => c.id === id); + if (match && match.kind !== kind) { + throw new Error(`Configuration '${id}' belongs to '${match.kind}', not '${kind}'`); + } + } else { + id = `${kind}:${crypto.randomUUID().slice(0, 8)}`; + } + const base = existingAll.find((c) => c.id === id); + const nextConfig: RunConfig = { + ...(base ?? { + id, + name: a.draft.name, + kind, + command: "", + args: [], + cwd: null, + env: {}, + detected: false, + isTest: false, + debugAdapter: null, + allowParallel: false, + emulateTerminal: false, + params: {}, + }), + id, + kind, + name: a.draft.name, + command: a.draft.command ?? base?.command ?? "", + args: [...a.draft.args], + cwd: a.draft.cwd, + env: Object.fromEntries(a.draft.env), + params: { ...(base?.params ?? {}), ...Object.fromEntries(a.draft.params) }, + allowParallel: a.draft.allowParallel, + detected: false, + }; + const updated = userConfigs.some((c) => c.id === id) + ? userConfigs.map((c) => (c.id === id ? nextConfig : c)) + : [...userConfigs, nextConfig]; + const { saveUserConfigs } = await import("./store"); + await saveUserConfigs(updated, []); + useRun.setState({ selectedId: id }); + a.onSaved?.(id); + }, + }, { id: "run.runConfig", title: "Run Configuration", diff --git a/src/features/run/javaDebug.ts b/src/features/run/javaDebug.ts index de0894bbff..9699a3ad66 100644 --- a/src/features/run/javaDebug.ts +++ b/src/features/run/javaDebug.ts @@ -19,7 +19,8 @@ import { optsOutOfAttach, } from "@/platform/javaLaunch"; import { applyBuildPolicyToCommand } from "./buildCommand"; -import { startRun, useRun } from "./store"; +import { parsePluginJavaDebug } from "@/workbench/contributions"; +import { startRun, useRun, type RunSession } from "./store"; import { isJunitRunner } from "./application"; import { DELEGATED_ATTACH_LISTENER, DELEGATED_DEBUG, DELEGATED_MAIN } from "./gradleRun"; import { isWindows } from "./jvmTypes"; @@ -214,3 +215,55 @@ export async function debugWithAgent(config: RunConfig, show?: boolean): Promise waiting.splice(0).forEach(attach); return true; } + +/** Starts a plugin configuration and attaches Java JDWP over loopback once listening (API 1.21). */ +export async function debugPluginJava( + config: RunConfig, + options: { + origin?: RunConfig; + show?: boolean; + prepared?: boolean; + typePrepared?: boolean; + onExit?: (code: number | null, stopped: boolean) => void; + } = {}, +): Promise<RunSession | null> { + const target = parsePluginJavaDebug(config); + if (!target) return null; + if (!(await attachDebuggerReady(config, options.show))) return null; + let sessionId: string | null = null; + let attachedPort: number | null = null; + const waiting: number[] = []; + const attach = (port: number) => { + if (attachedPort !== null) return; + attachedPort = port; + const runId = useRun.getState().sessions.find((s) => s.id === sessionId)?.runId ?? null; + void executeAction("debug.attach", { + name: config.name, + module: config.module ?? config.cwd ?? "", + hostName: target.host, + port, + process: runId, + runConfig: options.origin ?? config, + show: options.show, + }); + }; + const session = await startRun(config, undefined, undefined, { + show: options.show, + prepared: options.prepared, + typePrepared: options.typePrepared, + onExit: options.onExit, + onLine: (line) => { + const port = jdwpListeningPort(line); + if (port === null) return; + if (sessionId) attach(port); + else waiting.push(port); + }, + }); + if (!session) return null; + sessionId = session.id; + const detected = waiting.shift() ?? target.port; + if (detected !== undefined) { + attach(detected); + } + return session; +} diff --git a/src/features/run/store.ts b/src/features/run/store.ts index df9a51a0d6..bb3fdf9c87 100644 --- a/src/features/run/store.ts +++ b/src/features/run/store.ts @@ -34,7 +34,13 @@ import { useProject } from "@/platform/project"; import { isRemoteWindow } from "@/platform/remote"; import { executeAction } from "@/platform/actions"; import { workflowSettings } from "@/platform/workflowSettings"; -import { maybeEditorService, notifications, toolWindowService, useDebugRunSessions } from "@/workbench/contributions"; +import { + maybeEditorService, + notifications, + stripTransientPluginParams, + toolWindowService, + useDebugRunSessions, +} from "@/workbench/contributions"; import { applyBuildPolicyToCommand } from "./buildCommand"; import { ConsoleModel } from "./console"; import { jvmFrameTarget } from "./links"; @@ -685,7 +691,7 @@ export async function saveUserConfigs(user: RunConfig[], removedDetectedIds: str ); await call( commands.runSaveConfigs( - user.map((c) => ({ ...c, detected: false })), + user.map((c) => ({ ...stripTransientPluginParams(c), detected: false })), removedDetectedIds, ), ); @@ -1235,6 +1241,7 @@ async function startRunIn( (frameworkFor(launch) === "cypress" ? typeFor("cypress")?.prepareLaunch : undefined)); if (prepare) { launch = await prepare(launch, { + mode: "run", report: (text, kind = "system") => { enqueue(sessionId, { kind, text }); flush(sessionId); diff --git a/src/platform/locales/text/en.json b/src/platform/locales/text/en.json index 82bf8eb266..32a439154d 100644 --- a/src/platform/locales/text/en.json +++ b/src/platform/locales/text/en.json @@ -1826,6 +1826,8 @@ "Run any IDE action or other plugins' commands as if you chose them, including running programs, committing and pushing": "Run any IDE action or other plugins' commands as if you chose them, including running programs, committing and pushing", "Run Plugin Configuration": "Run Plugin Configuration", "Open Plugin Terminal Session": "Open Plugin Terminal Session", + "Stop Plugin Run": "Stop Plugin Run", + "Save Plugin Run Configuration": "Save Plugin Run Configuration", "Constructor…": "Constructor…", "Getter…": "Getter…", "Setter…": "Setter…", diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json index 8ff0a02d92..ddf6f2b8de 100644 --- a/src/platform/locales/text/zh.json +++ b/src/platform/locales/text/zh.json @@ -8728,6 +8728,8 @@ "Run Plugin Configuration": "运行插件配置", "Open Plugin Terminal Session": "打开插件终端会话", "Debug Plugin Configuration": "调试插件配置", + "Stop Plugin Run": "停止插件运行", + "Save Plugin Run Configuration": "保存插件运行配置", "Expected: {0}": "期望值:{0}", "Actual: {0}": "实际值:{0}", "Use {0} for running PHP / Node / Composer in this project?": "在此项目中使用 {0} 运行 PHP / Node / Composer?", diff --git a/src/workbench/ContributedToolbar.tsx b/src/workbench/ContributedToolbar.tsx index 59ae9748b0..fdbc0c4096 100644 --- a/src/workbench/ContributedToolbar.tsx +++ b/src/workbench/ContributedToolbar.tsx @@ -1,23 +1,31 @@ -import { useActions } from "@/platform/actions"; /** Plugin action slots in existing editor and main toolbars. */ -import { useContextKeys, evaluateWhen } from "@/platform/context"; +import { useActions } from "@/platform/actions"; +import { useContextKeys, evaluateWhen, type ContextValue } from "@/platform/context"; import { IconButton } from "@/ui"; import { useMenuSlotItems } from "./contributions"; import { keepFocusOnPress } from "./focus"; -export function ContributedToolbar({ slot }: { slot: string }) { +export function ContributedToolbar({ + slot, + whenContext, + defaultArg, +}: { + slot: string; + whenContext?: Record<string, ContextValue>; + defaultArg?: string; +}) { const actions = useActions((s) => s.actions); const items = useMenuSlotItems((s) => s.slots[slot]); useContextKeys(); return ( <> {(items ?? []) - .filter((i) => evaluateWhen(i.when ?? undefined)) + .filter((i) => evaluateWhen(i.when ?? undefined, whenContext)) .map((i) => ( <IconButton key={i.action} icon={actions.get(i.action)?.icon ?? i.icon ?? "plugin"} action={i.action} - actionArg={i.arg} + actionArg={i.arg ?? defaultArg} title={i.label} size="small" onMouseDown={keepFocusOnPress} diff --git a/src/workbench/contributions.ts b/src/workbench/contributions.ts index 9945da401d..c441436c2f 100644 --- a/src/workbench/contributions.ts +++ b/src/workbench/contributions.ts @@ -2031,6 +2031,8 @@ export interface RunConfigTypeContribution { ownsWorkingDirectory?: boolean; /** The type's fields set environment variables (no separate field). */ ownsEnvironment?: boolean; + /** The type's form replaces the built-in Before launch tasks editor (API 1.21). */ + ownsBeforeLaunch?: boolean; /** Custom form may defer computing `command` until launch (`prepareLaunch`). */ commandOptional?: boolean; /** Matches dynamic `kind: "plugin"` configurations owned by this type. */ @@ -2040,7 +2042,7 @@ export interface RunConfigTypeContribution { /** Adjusts what is launched right before it starts (e.g. the environment selecting a Docker daemon). */ prepareLaunch?( config: RunConfig, - options?: { report?: (text: string, kind?: "system" | "stderr") => void }, + options?: { mode?: "run" | "debug"; report?: (text: string, kind?: "system" | "stderr") => void }, ): Promise<RunConfig>; /** * Called once the run's process ended with `code`. Docker uses it for what outlives the @@ -2063,6 +2065,102 @@ export interface RunConfigTypeContribution { debugAdapter?: string; } +export const PLUGIN_JAVA_DEBUG_PARAM = "__pluginJavaDebug"; +export const PLUGIN_LOG_FILES_PARAM = "__pluginLogFiles"; +export const PLUGIN_DEBUG_PARAM = "__pluginDebug"; + +export interface PluginJavaDebug { + host: string; + port?: number; + timeoutMs?: number; +} + +export interface PluginLogFile { + id: string; + title: string; + path: string; +} + +export function isLoopbackHost(host: string): boolean { + const normalized = host.trim().toLowerCase(); + return normalized === "127.0.0.1" || normalized === "localhost" || normalized === "::1"; +} + +export function parsePluginJavaDebug(config: Pick<RunConfig, "params">): PluginJavaDebug | null { + const raw = config.params?.[PLUGIN_JAVA_DEBUG_PARAM]; + if (!raw) return null; + try { + const parsed = JSON.parse(raw) as Partial<PluginJavaDebug>; + const host = typeof parsed.host === "string" && parsed.host.trim() ? parsed.host.trim() : "127.0.0.1"; + if (!isLoopbackHost(host)) return null; + const port = + typeof parsed.port === "number" && Number.isInteger(parsed.port) && parsed.port >= 1 && parsed.port <= 65535 + ? parsed.port + : undefined; + const timeoutMs = + typeof parsed.timeoutMs === "number" && + Number.isInteger(parsed.timeoutMs) && + parsed.timeoutMs >= 1000 && + parsed.timeoutMs <= 60000 + ? parsed.timeoutMs + : undefined; + return { host, port, timeoutMs }; + } catch { + return null; + } +} + +export function parsePluginLogFiles(config: Pick<RunConfig, "params">): PluginLogFile[] { + const raw = config.params?.[PLUGIN_LOG_FILES_PARAM]; + if (!raw) return []; + try { + const parsed = JSON.parse(raw); + if (!Array.isArray(parsed)) return []; + const out: PluginLogFile[] = []; + for (let i = 0; i < Math.min(parsed.length, 8); i++) { + const item = parsed[i] as Partial<PluginLogFile> | null; + if (!item || typeof item.title !== "string" || typeof item.path !== "string") continue; + if (!item.title.trim() || !item.path.trim()) continue; + out.push({ + id: typeof item.id === "string" && item.id.trim() ? item.id.trim() : `log-${i}`, + title: item.title, + path: item.path, + }); + } + return out; + } catch { + return []; + } +} + +export function stripTransientPluginParams(config: RunConfig): RunConfig { + const p = config.params; + if (!p || !(PLUGIN_JAVA_DEBUG_PARAM in p || PLUGIN_LOG_FILES_PARAM in p || PLUGIN_DEBUG_PARAM in p)) { + return config; + } + const rest = { ...p }; + delete rest[PLUGIN_JAVA_DEBUG_PARAM]; + delete rest[PLUGIN_LOG_FILES_PARAM]; + delete rest[PLUGIN_DEBUG_PARAM]; + return { ...config, params: rest }; +} + +export function pluginOwnerFromConfig(config: Pick<RunConfig, "id" | "kind">): string | null { + if (config.kind.startsWith("plugin:")) { + const rest = config.kind.slice("plugin:".length); + const sep = rest.indexOf(":"); + return sep > 0 ? rest.slice(0, sep) : null; + } + if (config.kind === "plugin") { + const rawId = config.id.startsWith("workspace:") ? config.id.split(":").slice(2).join(":") : config.id; + if (!rawId.startsWith("plugin:")) return null; + const rest = rawId.slice("plugin:".length); + const sep = rest.indexOf(":"); + return sep > 0 ? rest.slice(0, sep) : null; + } + return null; +} + export const useRunConfigTypes = create<{ types: Map<string, RunConfigTypeContribution> }>(() => ({ types: new Map(), })); diff --git a/wit/agents.wit b/wit/agents.wit index d5b0b101a4..b5d9918262 100644 --- a/wit/agents.wit +++ b/wit/agents.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Forking recorded native agent sessions into new tasks (API 1.18). Requires /// the `agents` capability. The session must belong to the invoking window's diff --git a/wit/commit.wit b/wit/commit.wit index 94a1c2882b..20426a680d 100644 --- a/wit/commit.wit +++ b/wit/commit.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// The commit being prepared in the window the current command or event came /// from (the Commit tool window, or the Commit dialog while it is open): the diff --git a/wit/completion-list.wit b/wit/completion-list.wit index 34d283648d..e6bba755cb 100644 --- a/wit/completion-list.wit +++ b/wit/completion-list.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Optional export (API 1.16, world `plugin-completion-list`): completion that /// can say its list is incomplete. A plugin exporting it is called instead of diff --git a/wit/database.wit b/wit/database.wit index 0284b0e9da..dc6daf0eae 100644 --- a/wit/database.wit +++ b/wit/database.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Plugin-owned project data sources. Requires database.sources and project trust. /// Runs on the Database subsystem's host, including on remote project servers. diff --git a/wit/decorations.wit b/wit/decorations.wit index d7bc073934..90e3ea0d00 100644 --- a/wit/decorations.wit +++ b/wit/decorations.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Editor and project-tree decorations (API 1.4). Requires project.read. An editor set /// follows its file: the file's own project, or the nearest one when it is outside them all. diff --git a/wit/details.wit b/wit/details.wit index ec0948bc00..1bedc44ba0 100644 --- a/wit/details.wit +++ b/wit/details.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// What the pane beside the Services tree shows for a plugin's node. interface detail-types { diff --git a/wit/diagnostics.wit b/wit/diagnostics.wit index 9f4d97d979..ee9d420d83 100644 --- a/wit/diagnostics.wit +++ b/wit/diagnostics.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Optional export (world `plugin-diagnostics`): problems in the current, /// possibly unsaved document, for the languages declared with the diff --git a/wit/endpoints.wit b/wit/endpoints.wit index b10ed5d8cd..ebf7647e01 100644 --- a/wit/endpoints.wit +++ b/wit/endpoints.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// HTTP endpoints found in a project (`[[contributes.endpoints]]`). interface endpoints-provider { diff --git a/wit/events.wit b/wit/events.wit index 740294de6e..83bce90173 100644 --- a/wit/events.wit +++ b/wit/events.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Workbench events, delivered in batches to `event-handler.handle`. interface events { @@ -41,13 +41,16 @@ interface events { /// work waits for it; it requires `events`) through `other`. /// API 1.18 also delivers `project-closed` (JSON project root string) and /// `watched-files-changed` (see `watch-paths`) through `other`. + /// API 1.21 also delivers `run-started` (JSON {id, config, debug}) through `other` + /// whenever one of this plugin's configurations starts (whether launched by the plugin + /// or by the user), and delivers `run-exited` for user-launched plugin configurations too. /// Kinds: `file-opened`, `file-saved`, `document-changed` (versioned UTF-16 /// replacements from explicit path subscriptions), `websocket-ready` /// (a host-owned connection has messages to drain), `caret-moved`, `files-changed` (batched disk changes /// as `other`, with created/modified/removed path lists in JSON), `editor-focused` (the focused editor /// changed), `vcs-changed` (a repository's state changed: commit, /// checkout, fetch…), `action-performed` (an IDE action ran), - /// `project-closed` (a project closed) and + /// `project-closed` (a project closed), `run-started`, `run-exited`, and /// `scheduled` (the `on-schedule` period elapsed); later IDEs add more, /// and an IDE that doesn't know one fails with `invalid`. /// Requires `events` (`events.input` for `action-performed`). diff --git a/wit/exports.wit b/wit/exports.wit index 96592f8003..d352203adc 100644 --- a/wit/exports.wit +++ b/wit/exports.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; interface lifecycle { use types.{context, error}; diff --git a/wit/extensions.wit b/wit/extensions.wit index f5e081470e..3492888e1c 100644 --- a/wit/extensions.wit +++ b/wit/extensions.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// What other plugins contributed to the extension points this plugin declares /// (`[[extension-points]]` in `plugin.toml`; the contributors list this plugin diff --git a/wit/file-actions.wit b/wit/file-actions.wit index 0a0f66690c..d386fe7bb7 100644 --- a/wit/file-actions.wit +++ b/wit/file-actions.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Optional export (world `plugin-file-actions`): quick fixes and /// refactorings that create, rename or delete files, next to the text edits diff --git a/wit/fs.wit b/wit/fs.wit index 5eb436bd81..ecd6cb9411 100644 --- a/wit/fs.wit +++ b/wit/fs.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Files outside the open projects: the configuration of the program a /// plugin integrates with, a tool installed elsewhere, a licence file. diff --git a/wit/host.wit b/wit/host.wit index 1e131c6372..cfce1430bf 100644 --- a/wit/host.wit +++ b/wit/host.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Writes to the IDE log, tagged with the plugin id. interface log { diff --git a/wit/hover-actions.wit b/wit/hover-actions.wit index 070c66a2bc..b7f3fa778e 100644 --- a/wit/hover-actions.wit +++ b/wit/hover-actions.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Optional export (world `plugin-hover-actions`): clickable actions rendered /// at the left edge of a line and revealed while the pointer is in the leftmost diff --git a/wit/hover.wit b/wit/hover.wit index c9be10359f..726313f77c 100644 --- a/wit/hover.wit +++ b/wit/hover.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Optional export (world `plugin-hover`): Markdown added to the hover of /// documents of the languages declared with the `hover` provider kind, diff --git a/wit/indexing.wit b/wit/indexing.wit index 7453f3ffe3..1c1bfe960b 100644 --- a/wit/indexing.wit +++ b/wit/indexing.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Cross-file associations a plugin publishes for the files it declares under /// `[[contributes.documentIndexers]]`. The host calls `index` in cancellable diff --git a/wit/injections.wit b/wit/injections.wit index 10608d5f6c..e2c79c58b1 100644 --- a/wit/injections.wit +++ b/wit/injections.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Embedded languages. The host routes plugin providers and configured language /// servers inside these ranges, preserving host-document UTF-16 coordinates. diff --git a/wit/inlay.wit b/wit/inlay.wit index b6d1498e65..78e483cd33 100644 --- a/wit/inlay.wit +++ b/wit/inlay.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Optional export (world `plugin-inlay-hints`): inline hints in documents of /// the languages declared with the `inlay-hints` provider kind, including diff --git a/wit/io.wit b/wit/io.wit index d9f3354a47..77f41019cf 100644 --- a/wit/io.wit +++ b/wit/io.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Problems in files, shown in the editor and the Problems view. interface diagnostics { diff --git a/wit/language-features.wit b/wit/language-features.wit index 1a6a722d4b..9abd049e42 100644 --- a/wit/language-features.wit +++ b/wit/language-features.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Additional language features, called only for declared API 1.4 provider kinds. /// Editor calls have a 50 ms soft / 500 ms hard budget; formatting has 5 seconds. diff --git a/wit/mcp.wit b/wit/mcp.wit index c1de914ec7..e2a6f0d65d 100644 --- a/wit/mcp.wit +++ b/wit/mcp.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Discovery of the IDE's built-in MCP server; never exposes its URL or token. interface mcp { diff --git a/wit/plugin.wit b/wit/plugin.wit index e802e21e13..42a119bcef 100644 --- a/wit/plugin.wit +++ b/wit/plugin.wit @@ -8,7 +8,7 @@ /// `fs` and `workspace`, and 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.20.0; +package openidea:plugin@1.21.0; world plugin { import log; diff --git a/wit/providers.wit b/wit/providers.wit index 2fb49ff34c..245f2c6d51 100644 --- a/wit/providers.wit +++ b/wit/providers.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Editor features a plugin provides for the languages it declares under /// `[[contributes.providers]]` (the host calls only declared kinds). They run diff --git a/wit/run-targets.wit b/wit/run-targets.wit index 2495bc1ce4..1b51595a55 100644 --- a/wit/run-targets.wit +++ b/wit/run-targets.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Project-scoped targets owned by the registering plugin (API 1.4). interface run-targets { diff --git a/wit/run.wit b/wit/run.wit index 6bfb18b74d..33f1dc3b35 100644 --- a/wit/run.wit +++ b/wit/run.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Launches this plugin's configurations in the invoking window's Run tool window. interface run { @@ -24,6 +24,30 @@ interface run { start: func(config: string, args: list<string>, debug: bool) -> result<string, error>; /// Starts an owned configuration with launch options, appending args (API 1.18). start-with-options: func(config: string, args: list<string>, options: start-options) -> result<string, error>; + /// Stops an active run started from one of this plugin's configurations (API 1.21). + /// Only from a window command/event. + stop: func(id: string) -> result<_, error>; + /// Payload for `upsert-configuration` (API 1.21). + record run-config-draft { + /// Existing saved config id to update (`none` creates a new configuration). + id: option<string>, + /// Id from one of this plugin's own `[[contributes.runConfigTypes]]`. + type-id: string, + name: string, + command: option<string>, + args: list<string>, + cwd: option<string>, + env: list<tuple<string, string>>, + params: list<tuple<string, string>>, + allow-parallel: bool, + } + /// Creates or updates a saved run configuration of one of this plugin's own + /// `contributes.runConfigTypes` in the invoking window's project (API 1.21). + /// Returns the saved configuration id. + upsert-configuration: func(draft: run-config-draft) -> result<string, error>; + /// Opens the Run/Debug Configurations dialog in the invoking window, optionally + /// selecting `config-id` (API 1.21). + open-edit-configurations: func(config-id: option<string>) -> result<_, error>; } /// Optional dynamic configurations, refreshed alongside run detectors. diff --git a/wit/search.wit b/wit/search.wit index 775cc03415..f5148ed49f 100644 --- a/wit/search.wit +++ b/wit/search.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// On-demand results for `[[contributes.searchCategories]]`. Optional, API 1.13. interface search-provider { diff --git a/wit/semantic.wit b/wit/semantic.wit index 551db318d7..3829da74b1 100644 --- a/wit/semantic.wit +++ b/wit/semantic.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Optional export (world `plugin-semantic-tokens`): semantic colouring of /// documents of the languages declared with the `semantic-tokens` provider diff --git a/wit/syntax-decorations.wit b/wit/syntax-decorations.wit index 3c5bdb4c32..84018b27a7 100644 --- a/wit/syntax-decorations.wit +++ b/wit/syntax-decorations.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Optional export (world `plugin-syntax-decorations`): foreground marks for /// documents of the languages declared with the `syntax-decorations` provider diff --git a/wit/types.wit b/wit/types.wit index d28702152d..90eca253a9 100644 --- a/wit/types.wit +++ b/wit/types.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Shared types. Positions are 0-based lines and UTF-16 code unit columns, /// as in the editor and LSP. diff --git a/wit/views.wit b/wit/views.wit index 9733418473..47a1d8e1ea 100644 --- a/wit/views.wit +++ b/wit/views.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; /// Declarative views: tool windows declared /// under `[[contributes.views]]` and custom editors under diff --git a/wit/workspace.wit b/wit/workspace.wit index d96234945a..a828cb3064 100644 --- a/wit/workspace.wit +++ b/wit/workspace.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.20.0; +package openidea:plugin@1.21.0; interface workspace { use types.{error, location};