diff --git a/crates/ide-extension/src/manifest.rs b/crates/ide-extension/src/manifest.rs index 883472949..41c43d444 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.16.0"; +pub const ENGINE_VERSION: &str = "1.17.0"; /// The 0.1 API, still accepted for contribution-only packages and 0.1 components. pub const LEGACY_API: &str = "0.1"; /// Marketplace categories, in the order they are shown. diff --git a/crates/ide-host/src/plugins/api.rs b/crates/ide-host/src/plugins/api.rs index abce8be29..3a934be50 100644 --- a/crates/ide-host/src/plugins/api.rs +++ b/crates/ide-host/src/plugins/api.rs @@ -4826,7 +4826,18 @@ impl PluginApi { if let Some(icon) = file.as_ref().and_then(|f| f.icon.as_ref()) { ide_extension::validate_item_id(icon, "file icon id").map_err(HostError::Invalid)?; } - items.retain(|d| decoration_style(&d.style)); + for colors in items.iter_mut().filter_map(|d| d.colors.as_mut()) { + for color in [&mut colors.foreground, &mut colors.background].into_iter().flatten() { + *color = decoration_color(color).ok_or_else(|| { + HostError::Invalid(format!("decoration color '{color}' is not #rrggbb or #rrggbbaa")) + })?; + } + } + items + .iter_mut() + .for_each(|d| d.colors = d.colors.take().filter(|c| c.foreground.is_some() || c.background.is_some())); + // An item with its own colors (API 1.17) may leave the style empty. + items.retain(|d| decoration_style(&d.style) || (d.style.is_empty() && d.colors.is_some())); if items.iter().any(|d| d.range.start > d.range.end) { return Err(HostError::Invalid("reversed decoration range".into())); } @@ -4924,6 +4935,13 @@ impl PluginApi { Ok(()) } } +/// A `set-styled` color as the editor renders it: `#rrggbb` or `#rrggbbaa`, lower case. +fn decoration_color(color: &str) -> Option { + let hex = color.strip_prefix('#')?; + ((hex.len() == 6 || hex.len() == 8) && hex.bytes().all(|b| b.is_ascii_hexdigit())) + .then(|| format!("#{}", hex.to_ascii_lowercase())) +} + fn decoration_style(style: &str) -> bool { matches!( style, @@ -5058,9 +5076,38 @@ mod workbench_tests { hover: None, after: Some("after".into()), markdown_hover: None, + colors: None, }; api.decorations(Some(&path), "set", vec![item("highlight"), item("unknown")]).unwrap(); assert_eq!(api.shared.decoration_sets()["test"][0].items.len(), 1); + // Styled items (API 1.17): colors are validated and normalized; an empty style needs colors. + let colored = |style: &str, foreground: Option<&str>, background: Option<&str>| ide_plugin::Decoration { + colors: Some(ide_plugin::DecorationColors { + foreground: foreground.map(Into::into), + background: background.map(Into::into), + }), + ..item(style) + }; + api.decorations( + Some(&path), + "styled", + vec![ + colored("", Some("#1A1A1A"), Some("#FFEB3BFF")), + colored("highlight", None, Some("#00e5ff")), + colored("", None, None), + item(""), + ], + ) + .unwrap(); + let styled = api.shared.decoration_sets()["test"].iter().find(|s| s.set_id == "styled").unwrap().items.clone(); + assert_eq!(styled.len(), 2); + let first = styled[0].colors.as_ref().unwrap(); + assert_eq!((first.foreground.as_deref(), first.background.as_deref()), (Some("#1a1a1a"), Some("#ffeb3bff"))); + for bad in ["red", "#fff", "#12345g", "rgb(0,0,0)", "#1234567", "#ffffff; x: y"] { + let err = api.decorations(Some(&path), "styled", vec![colored("", Some(bad), None)]).unwrap_err(); + assert!(matches!(err, HostError::Invalid(ref m) if m.contains("#rrggbb")), "{bad}: {err}"); + } + api.decorations(None, "styled", vec![]).unwrap(); // Decorations follow the file: a path outside the open project is accepted too. api.decorations(Some(&root.join("../outside.txt")), "set", vec![]).unwrap(); assert_eq!(api.shared.decoration_sets()["test"].len(), 2); diff --git a/crates/ide-host/tests/plugins.rs b/crates/ide-host/tests/plugins.rs index 68558f0bf..a2461557e 100644 --- a/crates/ide-host/tests/plugins.rs +++ b/crates/ide-host/tests/plugins.rs @@ -7010,6 +7010,31 @@ fn markdown_decorations_publish_a_hover_card_and_clear() { assert!(f.host.decoration_sets()["decorations"].is_empty()); } +/// API 1.17: `set-styled` items carry their own colors, normalized by the host, and replace +/// the set's earlier kind of items. +#[test] +fn styled_decorations_carry_normalized_colors() { + let f = fixture(Limits::default()); + f.install(&sample("decorations")); + f.run("decorations", "publish", Some("src/notes.txt")).unwrap(); + f.run("decorations", "styled", Some("src/notes.txt")).unwrap(); + let sets = f.host.decoration_sets(); + let set = &sets["decorations"][0]; + assert_eq!(set.set_id, "example"); + let colors: Vec<_> = set.items.iter().map(|d| (d.style.as_str(), d.colors.clone().unwrap())).collect(); + assert_eq!( + colors, + [ + ( + "", + ide_plugin::DecorationColors { foreground: Some("#1a1a1a".into()), background: Some("#ffeb3b".into()) } + ), + ("", ide_plugin::DecorationColors { foreground: None, background: Some("#00e5ff80".into()) }), + ] + ); + f.run("decorations", "clear", None).unwrap(); +} + // ─── Project window groups ──────────────────────────────────────────────────── // A group's container root holds only `.openidea` metadata; the files live in // the member projects. The plugin surface reaches them like the editor and the diff --git a/crates/ide-plugin/src/runtime.rs b/crates/ide-plugin/src/runtime.rs index bcafb38cb..1588d2f16 100644 --- a/crates/ide-plugin/src/runtime.rs +++ b/crates/ide-plugin/src/runtime.rs @@ -59,7 +59,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.16"; +pub const API_VERSION: &str = "1.17"; 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. diff --git a/crates/ide-plugin/src/types.rs b/crates/ide-plugin/src/types.rs index e4811791f..613afedc4 100644 --- a/crates/ide-plugin/src/types.rs +++ b/crates/ide-plugin/src/types.rs @@ -1023,6 +1023,15 @@ pub struct Decoration { /// Markdown rendered in the editor's hover card (API 1.16); `hover` is the /// plain-text fallback shown when this is absent. pub markdown_hover: Option, + /// The item's own colors (API 1.17 `set-styled`), validated `#rrggbb` / `#rrggbbaa`. + #[serde(default)] + pub colors: Option, +} +/// Colors of a styled editor decoration (API 1.17). +#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Type)] +pub struct DecorationColors { + pub foreground: Option, + pub background: Option, } /// A tree decoration. #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)] diff --git a/crates/ide-plugin/src/wit_host.rs b/crates/ide-plugin/src/wit_host.rs index 6bb647361..482ad0afe 100644 --- a/crates/ide-plugin/src/wit_host.rs +++ b/crates/ide-plugin/src/wit_host.rs @@ -2888,6 +2888,7 @@ impl bindings::openidea::plugin::decorations::Host for StoreData { hover: d.hover, after: d.after, markdown_hover: None, + colors: None, }) .collect(); self.replace_decorations(path, set_id, items) @@ -2906,6 +2907,28 @@ impl bindings::openidea::plugin::decorations::Host for StoreData { hover: d.hover, after: d.after, markdown_hover: d.markdown_hover, + colors: None, + }) + .collect(); + self.replace_decorations(path, set_id, items) + } + fn set_styled( + &mut self, + path: String, + set_id: String, + items: Vec, + ) -> Fallible<()> { + let items = items + .into_iter() + .map(|d| crate::Decoration { + range: core_range(d.range), + style: d.style, + hover: d.hover, + after: d.after, + markdown_hover: d.markdown_hover, + colors: d + .colors + .map(|c| crate::DecorationColors { foreground: c.foreground, background: c.background }), }) .collect(); self.replace_decorations(path, set_id, items) diff --git a/crates/ide-plugin/tests/api_compat.rs b/crates/ide-plugin/tests/api_compat.rs index 2fb14073b..61cc1d9fe 100644 --- a/crates/ide-plugin/tests/api_compat.rs +++ b/crates/ide-plugin/tests/api_compat.rs @@ -95,7 +95,7 @@ fn the_sdk_carries_the_hosts_wit() { #[test] fn the_version_check_runs_compatible_components_and_explains_the_rest() { - let host = v("1.16.0"); + let host = v("1.17.0"); for ok in [ "1.0.0", "1.3.0", @@ -112,15 +112,16 @@ fn the_version_check_runs_compatible_components_and_explains_the_rest() { "1.14.0", "1.15.0", "1.16.0", + "1.17.0", "1.0.0-rc.1", ] { assert_eq!(check_api(&v(ok), &host), Ok(()), "{ok}"); } - let newer = check_api(&v("1.17.0"), &host).unwrap_err(); - assert!(newer.contains("1.17") && newer.contains("update OpenIDEA"), "{newer}"); + let newer = check_api(&v("1.18.0"), &host).unwrap_err(); + assert!(newer.contains("1.18") && 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.16 SDK"), "{older}"); + assert!(older.contains("rebuild it with the 1.17 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 64d42c9ca..4b7705890 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 33c779341..1d0e12257 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 @@ -68517d169bea40ca5a5426a3a05ace3389417073b9369e79157a2beb051dcfc0 +98e9c2b886df177bafb68a712fc1efadc4f3a7b82e8425cd1b3f4c2355bdb785 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 a51e3be22..9201067cd 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 c1e6a2c40..74ecd5690 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 @@ -6edda84fad0ee7cd56a3a28b55e6c559db7b7f6b9c8c0ca645be805b545c01e7 +bb77bc0963451ca4259591bf68c72ae3eb70b1c6f855fa29dfc84d2be675404c diff --git a/crates/ide-plugin/tests/fixtures/clipboard/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/clipboard/dist/plugin.wasm index 196fbc772..5b4e7a494 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 049f35d5a..8c8d99627 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 @@ -ecc6b6c52753b11521ae033a5a66c2a289119e09e07d22742203d3a13122dd97 +f381b0e20520bccf5acd46b95641f5542885184352e52ec2fed3fd53665c353b diff --git a/crates/ide-plugin/tests/fixtures/commit/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/commit/dist/plugin.wasm index 484b65c1f..57448e724 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 6c77470e9..d6d6dbbe3 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 @@ -4ec581c69a62bbf424983e241a79d0bfdb5d025a3e86d27eea745adcb1906253 +f72a53e7b800b8c5408c7ac67034821f814da7b1d66f527949450431bcf52e02 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 f5d0131ad..9e6bc2792 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 b0a0ec7a1..24f6e8730 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 @@ -5fb89ee3d07e4275433ad9ad930ad781ef4f227af11aa5eb9dfc9174c015b1b8 +3cd2f02738b07d9a6294025cbcc6e906716d3e91db50a6f39485df9b1d6a4ead 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 1a20adae8..acf8d3326 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 66efebd1f..7773f0ef2 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 @@ -236db5a85d3e7e9fee01c3ff0b9f5e66fad7e3d64fa618a0c1c980d9e5883839 +d77b80884163628791b292acc59324d3b9a7c2236034b88f87e8f56af5929a48 diff --git a/crates/ide-plugin/tests/fixtures/decorations/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/decorations/dist/plugin.wasm index c06dfc290..80deedacc 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 37ec9b65f..e3ece63cf 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 @@ -4f89bd09b571016cbb9feb0674e668aa66996997c6b53a91d1a4ffbf161083a3 +5a79d35e9fc1560a39b6459312a14c27c73739fd385f6c2568f9b1c1bf8fe4a1 diff --git a/crates/ide-plugin/tests/fixtures/decorations/plugin.toml b/crates/ide-plugin/tests/fixtures/decorations/plugin.toml index 8b4e52850..c1077c9c3 100644 --- a/crates/ide-plugin/tests/fixtures/decorations/plugin.toml +++ b/crates/ide-plugin/tests/fixtures/decorations/plugin.toml @@ -1,10 +1,10 @@ id = "decorations" name = "Decoration example" version = "0.1.0" -description = "Minimal plugin API 1.16 example: line-end labels with Markdown hover cards." +description = "Minimal plugin API 1.17 example: line-end labels with Markdown hover cards and their own colors." authors = ["OpenIDEA contributors"] license = "Apache-2.0" -engines.openidea = "^1.16" +engines.openidea = "^1.17" wasm = "dist/plugin.wasm" activation = ["on-command:*"] @@ -15,6 +15,10 @@ required = ["project.read"] id = "publish" title = "Decorations: Publish" +[[contributes.commands]] +id = "styled" +title = "Decorations: Publish Styled" + [[contributes.commands]] id = "clear" title = "Decorations: Clear" diff --git a/crates/ide-plugin/tests/fixtures/decorations/src/lib.rs b/crates/ide-plugin/tests/fixtures/decorations/src/lib.rs index d8719b35e..915ff71eb 100644 --- a/crates/ide-plugin/tests/fixtures/decorations/src/lib.rs +++ b/crates/ide-plugin/tests/fixtures/decorations/src/lib.rs @@ -1,6 +1,10 @@ -//! Minimal plugin API 1.16 example: push a line-end label whose hover is Markdown. +//! Minimal plugin API 1.17 example: push a line-end label whose hover is Markdown, +//! and ranges painted in the plugin's own colors. -use openidea_plugin::{Error, Invocation, MarkdownDecoration, Plugin, Position, Range, host, register_plugin}; +use openidea_plugin::{ + DecorationColors, Error, Invocation, MarkdownDecoration, Plugin, Position, Range, StyledDecoration, host, + register_plugin, +}; #[derive(Default)] struct Decorations; @@ -23,6 +27,29 @@ impl Plugin for Decorations { )?; Ok(None) } + "styled" => { + let path = arg.ok_or_else(|| Error::Invalid("a project file path is required".into()))?; + let todo = |range, foreground: Option<&str>, background: &str| StyledDecoration { + range, + style: String::new(), + hover: Some("TODO".into()), + after: None, + markdown_hover: None, + colors: Some(DecorationColors { + foreground: foreground.map(Into::into), + background: Some(background.into()), + }), + }; + host::set_styled_decorations( + path, + "example", + &[ + todo(Range::new(Position::new(0, 0), Position::new(0, 1)), Some("#1A1A1A"), "#FFEB3B"), + todo(Range::new(Position::new(0, 1), Position::new(0, 2)), None, "#00e5ff80"), + ], + )?; + Ok(None) + } "clear" => { host::clear_decorations("example")?; Ok(None) 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 789d5fe58..507a4b278 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 3b95111fc..02ac8b386 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 @@ -c5c3bac9e2b69e4957bd5049d4f560dd04faf4dfc2d7523bb7968aa29f3bdcfb +264be0e527b0cc200e2d97e982b7b297ef6181a7669506ccf09159531f91124d diff --git a/crates/ide-plugin/tests/fixtures/diagnostics/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/diagnostics/dist/plugin.wasm index a4c6d141d..088734ca7 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 44819de28..f906e66a5 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 @@ -a75758a44e255b7df3adf53e5f81b8f1283270d28f78ad0d8b358d9feea98a99 +6230dce145f2cce3033c4797566cbbff8c98e5d8c85d41f9342693b19a10b638 diff --git a/crates/ide-plugin/tests/fixtures/endpoints/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/endpoints/dist/plugin.wasm index 6e041a185..b609e0595 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 01cbcae38..342c85a3a 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 @@ -7e658a971fd58b84fcadc1f4939991d5f4506936989d4c8a7302ccebc0455e9c +3d7d853fa40ce14ae6781dbf5607153c4f38b2663a31f1ca29a753e8eba79f03 diff --git a/crates/ide-plugin/tests/fixtures/execution/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/execution/dist/plugin.wasm index 49a20634e..f103327d0 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 6d7586c0a..f146f3795 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 @@ -6b7c0d8971cfd3ba1d80c5fc6428e5890c820350972597a11be4ea6f0324973f +a128c5f640b42d323059a7be1bd2e89cb9de1ea1ea635b5af4e9f69b66bfd04c 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 55468da46..69c970f3f 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 e191ea10a..16c64f633 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 @@ -20e43b6ac3aaa1527874f98f4b502ef88dd4676b6096b989c7bfba7a521e723d +9e00f4bcad39a99f05c35ac66962a574f7edd5713f1aa404ef72fd7ef945d1e8 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 e78c76954..c30d6ecee 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 204ba66e2..3a36897b5 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 @@ -f879df5a331ec439c7e74af4d9c7d249477239e3a0a59d5e612548623cf5e9e2 +7e0ae6bfc8217c37a68e9010920a5bd3478f654b6cfaf3f54e0ef5aacae546b8 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 3e0dcd30e..6e06773a1 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 e466b942d..fb82db9a1 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 @@ -de1fc37d8fd5993164e0d903a0f1b4ba15005f2a90de325d7f4b4902a363fdf1 +97c4d6aaf88d552d736021e21bb1f1e1594800ceb771644eb1f3356c0efbc42a 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 db758d592..1702815de 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 4973cb7b4..f67342522 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 @@ -367366c14b69d8f3837e731e061768ec5cb344d86fba89ced63fb196e5ca475e +5a65f921bb1f0ed0f0f10811f8960d9ea9e7ded59d5172356e7cc93f05b4bd5e diff --git a/crates/ide-plugin/tests/fixtures/hello/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/hello/dist/plugin.wasm index d229ed8a4..d5f81532e 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 ea6716108..3e0f8ef44 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 @@ -b7bccc7f93b409263293d2dff8a31dbdcfcdfba133815f3ff60bc70a073257de +2d148151a9b0a2ab4c479183e3d2ab07d0432d8645dbf95c0e04385ef25830d8 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 07ebb2ffe..713e4981c 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 833da8bf8..9aadbf012 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 @@ -f28d85f2004adcdf4e43faa57b7a5b52ab5d8233579979062461b0c5b4c63e10 +63136a78f4279b140c74ff07146b79ca2ce6c7a4fffd6176e811828aad911e0e diff --git a/crates/ide-plugin/tests/fixtures/hover/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/hover/dist/plugin.wasm index c96820374..05f91ebb0 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 138f22dc9..aa8614910 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 @@ -23c2c5e6e208104979e1f5b8620d2279547d372f0accf893c2d7797399fe39b0 +e6bf5c74e18ab47577c1e88294fa4961fe8a1e56fb3e34fec5154dab74dfd805 diff --git a/crates/ide-plugin/tests/fixtures/indexer/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/indexer/dist/plugin.wasm index f8b553c8d..3e3a60704 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 ba0a1fe62..5e5018ca8 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 @@ -57fc9ea26136a56fa2f502e4bb17531df3f5eed092fde1267199e2447c8fbc23 +ad5a9fef07a6e9db8fe0375d0ba9d2e92247c28303876ac52db2dbf938bf96ae 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 f4cd809de..f2b46deef 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 1fec140cf..02105135f 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 @@ -105017e20dd7a93cecb178576f2718ccf8433a6fac027b5708d6e2121f85e27a +fdbcd1afce0d106be463ef43d31245fcb4b9e84287ede78fb8abe740ea28b247 diff --git a/crates/ide-plugin/tests/fixtures/jobs/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/jobs/dist/plugin.wasm index 94e831613..60491e443 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 e46438f8b..c4e579805 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 @@ -ae72f5db42f508bd8faac6134f6e9a785a8fdcdda823af32cb56e5936c157bf9 +c9eb17c9f7e334b05bc5104204fb12a88dceafe36dbd04510e439539f2a1d464 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 973515d10..26c27c0c0 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 87144c487..947826789 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 @@ -d773509ce0beebc88b769d8346aaafa39b1201d959c4afd16d680c63cef919d5 +14ba72bbc8013b8e2a7f87e85a7046edc4fb4a2256f3fae3ac735241096e4428 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 cf958f572..b9309acd9 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 1524350dc..e60a5485f 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 @@ -1b15f24dc006f18260c746d9651cdaa2416e7871397e21f2935f50d316b88f67 +91b190eb62077bde52916a09d76a474584725e73cf3acf45613aecbc8c37c421 diff --git a/crates/ide-plugin/tests/fixtures/misbehave/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/misbehave/dist/plugin.wasm index 6b9fa7ed7..a89debcb8 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 d056a4c93..52c2edf53 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 @@ -8249c0aa3ab7621f5cb33e2afea6babf3370749757f0957360e5c40f0c15ff66 +90b20d5ec2d36fa585e3f921672b6477c9691f184151f7059dd429fd7ccc09cf diff --git a/crates/ide-plugin/tests/fixtures/misbehave/src/lib.rs b/crates/ide-plugin/tests/fixtures/misbehave/src/lib.rs index bb0c8f6b9..e1726aa8b 100644 --- a/crates/ide-plugin/tests/fixtures/misbehave/src/lib.rs +++ b/crates/ide-plugin/tests/fixtures/misbehave/src/lib.rs @@ -5,9 +5,9 @@ wit_bindgen::generate!({ inline: " package fixture:misbehave; world misbehave { - include openidea:plugin/plugin-syntax@1.16.0; - export openidea:plugin/providers@1.16.0; - export openidea:plugin/file-actions@1.16.0; + include openidea:plugin/plugin-syntax@1.17.0; + export openidea:plugin/providers@1.17.0; + export openidea:plugin/file-actions@1.17.0; } ", path: "../../../../../wit", 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 a470e4828..e0a2640d8 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 b7d93d369..a9321f1cd 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 @@ -0006724d54d1acb732d2d4f77d67c855b5a560747537c11eb48cb0cb988d9783 +0f7fc3035725b0262925b9e062bb72bf1e875eab4aa1eb040df4c1708db7c4bd 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 50e7d5870..f80412adf 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 9eedfb855..4294cfd10 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 @@ -5985abd096cf5d957f17302ecd9d785fbc975e409b945c3b5c7ef84b2890e6b0 +0dc9ad2f7c8c73c92e36cf709e5275d13ed4f5067b1322f0a76160ff92bf8bdc diff --git a/crates/ide-plugin/tests/fixtures/search/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/search/dist/plugin.wasm index 966c50379..992de3d71 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 0c3018710..617eea4d7 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 @@ -5e0ee5752d6c418b96b7dd3f0bfaea3e034eb868d4edb847b42cc8c33eef1257 +6e17ea89659c70e925075d2825d34c61252ab511ccb2bdbad7af29d76b97b84e 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 8f2bdcab4..0770b8efd 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 c0b3988a1..208f26054 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 @@ -281c04d6fb2999a6f4967475fa19dd9f0ee887c7cf2b323951f124562ea27389 +2d221e76206dac71941d749626700537e003642fc862934e832366f73b862831 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 4f8d57fdd..c79889ebb 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 860685d52..ef08f72b9 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 @@ -ca75434712f4f1709943a84f7bb8907479395109d1e160171314fcf768c73ef8 +b6ac119e4a85cf0c53bce81d1fe70a3c086c7c3764f1cbc6bd19878da124cc97 diff --git a/crates/ide-plugin/tests/fixtures/storage/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/storage/dist/plugin.wasm index f258d6efb..a463455e1 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 6545025b4..9ce2266a3 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 @@ -51d29c00405b9e364755dec2ce22eeaaa3b06ef5218244179be73e8ab03e815f +c71e5ea2112f545be3b3c1afadd20c46f931632ee78feeb06e0945a550bc76d3 diff --git a/crates/ide-plugin/tests/fixtures/symbols/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/symbols/dist/plugin.wasm index a79c61dde..924ff0e2b 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 ffb99daf8..e25cde792 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 @@ -5e9db81302adfaab77c1cf6545cdc2cd7b0b1bed29e68ed8160b487694da043a +1b29775537e80017a5d1e5999bbc611204c696f0951818664533b51e3903f3d6 diff --git a/crates/ide-plugin/tests/fixtures/tables/dist/plugin.wasm b/crates/ide-plugin/tests/fixtures/tables/dist/plugin.wasm index 1afb8a89d..b0e6e0cb3 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 8789b16b0..14942de9c 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 @@ -e66d84009ab855107a8614a146e3e21c34a767c590f2b0f10157b0546e532008 +92b03822689a82c8479751af6b6dfd593ad7a1f0a8e55071819520fdccd90570 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 e174b5cb8..bd6cdef4e 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 22206bd25..ec7bff393 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 @@ -42e2ca709640744b0a00c0ab44911b2204417744c7402271f759ee630de79cf2 +a8a8b4b2fd8f506f22734d07aa3375dca027aae9eac1d4b243997482c46561c1 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 00065f46f..0d2cc7c0d 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 b38300c7f..d74a06e00 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 @@ -161f4797c5a371dd3fe5e9c02a75d444c357e88db7a55e53b3cc6d22af021d38 +51b39ce770af475df93655210932a43616d43653209ade5c5402183f4b63950a 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 9851dadd9..089172cce 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 9b3acd96b..dcb45ec24 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 @@ -f5e228a477aee1f902d74b532838b96cd6c07b0416037c76dfe25744724d3094 +0bc832accea72dae9df6e95c985ee5ac330cb9b8fb6a0608d9ddeabcd9668610 diff --git a/docs/en/plugins/versioning.mdx b/docs/en/plugins/versioning.mdx index 9078a5a5e..ace732125 100644 --- a/docs/en/plugins/versioning.mdx +++ b/docs/en/plugins/versioning.mdx @@ -30,7 +30,8 @@ The plugin API has one version number: the version of the WIT package in [`wit/` | 1.13.0 | OpenIDEA 0.1.49 | Optional `search-provider` export and `searchCategories`: custom Search Everywhere tabs with cancellable queries | | 1.14.0 | In development on `main` | Optional `hover-actions` export: left-edge line actions revealed by line-edge hover, with an anchor line and inclusive trigger range; `[[contributes.javaAgents]]` `vmOptions` / `jdk`: JVM flags (optionally JetBrains Runtime–only) before `-javaagent:`; `ui.set-status-item-menu` / `set-window-status-item-menu`: a menu on a status bar item | | 1.15.0 | In development on `main` | `caret-moved` event; declarative `[[contributes.skills]]` (`path = "skills//SKILL.md"`) for bundling agent skills in plugins | -| 1.16.0 | In development on `main` | Optional `completion-list-provider` export: completion marked incomplete is asked again while typing on, without re-asking the language server or other plugins; `decorations.set-markdown`: line-end decorations whose hover is a Markdown card | +| 1.16.0 | OpenIDEA 0.1.52 | Optional `completion-list-provider` export: completion marked incomplete is asked again while typing on, without re-asking the language server or other plugins; `decorations.set-markdown`: line-end decorations whose hover is a Markdown card | +| 1.17.0 | In development on `main` | `decorations.set-styled`: editor decorations with their own `#rrggbb` / `#rrggbbaa` foreground and background, for colors outside the theme palette | 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/versioning.mdx b/docs/zh/plugins/versioning.mdx index d97515eaa..08b71943e 100644 --- a/docs/zh/plugins/versioning.mdx +++ b/docs/zh/plugins/versioning.mdx @@ -27,7 +27,8 @@ description: "engines.openidea、插件 API 从 1.0 到 1.13 的各个版本, | 1.13.0 | OpenIDEA 0.1.49 | 新增 `search-provider` 导出和 `searchCategories` 贡献点:可取消查询的全局搜索自定义分类 | | 1.14.0 | `main` 上开发中 | 可选 `hover-actions` 导出:行内侧 hover 显示的左侧操作,带锚定行和包含式触发行范围; `[[contributes.javaAgents]]` 的 `vmOptions` / `jdk`:在 `-javaagent:` 之前注入 JVM 参数(可选仅 JetBrains Runtime);`ui.set-status-item-menu` / `set-window-status-item-menu`:状态栏项菜单 | | 1.15.0 | `main` 上开发中 | `caret-moved` 事件;声明式 `[[contributes.skills]]`(`path = "skills//SKILL.md"`),在插件包中打包代理技能 | -| 1.16.0 | `main` 上开发中 | 可选 `completion-list-provider` 导出:标记为不完整的补全在继续输入时再次询问,不会重新询问语言服务器和其他插件;`decorations.set-markdown`:悬停显示 Markdown 卡片的行尾装饰 | +| 1.16.0 | OpenIDEA 0.1.52 | 可选 `completion-list-provider` 导出:标记为不完整的补全在继续输入时再次询问,不会重新询问语言服务器和其他插件;`decorations.set-markdown`:悬停显示 Markdown 卡片的行尾装饰 | +| 1.17.0 | `main` 上开发中 | `decorations.set-styled`:自带 `#rrggbb` / `#rrggbbaa` 前景色和背景色的编辑器装饰,用于主题调色板之外的颜色 | 每个版本新增内容的完整列表见 [`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 8f7266b6b..cf0c0f872 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 ``` -The plugin API is defined in [`wit/`](../wit/) (`openidea:plugin@1.16.0`, world +The plugin API is defined in [`wit/`](../wit/) (`openidea:plugin@1.17.0`, world `plugin`). ## 1. Quick start @@ -427,9 +427,23 @@ are always available. Calling a gated function without its capability returns ## 3. Writing code (Rust SDK) +### API 1.17 + +API 1.17.0 is in development on `main`. Use `engines.openidea = "^1.17"` and the +matching SDK. Plugins for 1.16 and earlier keep working. New in 1.17: + +- [Editor decorations](#editor-and-project-snapshots-api-14): + `host::set_styled_decorations` (`decorations.set-styled`) draws the same items as + `set_markdown_decorations` with their own `colors`: a `#rrggbb` or `#rrggbbaa` + foreground and background, for colors the theme palette does not have (a TODO + highlighter's user-chosen colors). An item with colors may leave `style` empty; + with a palette style the colors paint over it. Any other color string is rejected + with `Error::Invalid`. Set ids, limits and `clear_decorations` are shared with + `set_decorations`. + ### API 1.16 -API 1.16.0 is in development on `main`. Use `engines.openidea = "^1.16"` and the +API 1.16.0 shipped with OpenIDEA 0.1.52. Use `engines.openidea = "^1.16"` and the matching SDK. Plugins for 1.15 and earlier keep working. New in 1.16: - `Project::vcs_repository_at(path)` returns the mapped worktree owning an existing project file @@ -836,6 +850,7 @@ then run `openidea-plugin check`. | `TextEditor::set_selections(ranges)`, `reveal(range)` | `editor.text-editor` | API 1.4: selections or scrolling in this window's already open editor; no capability. Commands/events only, UTF-16 coordinates. | | `host::set_decorations`, `clear_decorations` | `decorations.{set,clear}` | API 1.4: project-scoped editor annotations cleared on plugin stop. Requires `project.read`. | | `host::set_markdown_decorations` | `decorations.set-markdown` | API 1.16: the same sets with `markdown_hover` cards; shares set ids and limits with `set_decorations`. Requires `project.read`. | +| `host::set_styled_decorations` | `decorations.set-styled` | API 1.17: those items with their own `#rrggbb` / `#rrggbbaa` `colors`; `style` may be empty when colors are set; shares set ids and limits with `set_decorations`. Requires `project.read`. | | `host::set_file_decoration`, `clear_file_decorations` | `decorations.{set-file,clear-file}` | API 1.4: project-tree badges/styles. Requires `project.read`. | | `host::set_file_note` | `decorations.set-file-note` | API 1.7: a note after the name in the project tree (one line, at most 200 characters). Requires `project.read`. | | `host::set_file_icon`, `set_file_icons` | `decorations.{set-file-icon,set-file-icons}` | API 1.8: assign one of the plugin's declared `[[contributes.fileIcons]]` icons to a file or plain folder by path (individually or up to 10,000 entries per set). Requires `project.read`. | @@ -1333,7 +1348,11 @@ unloading or crashing the plugin withdraws them; idle reclamation preserves them API 1.16 adds `set_markdown_decorations`: the same items, limits and set ids, with `markdown_hover` rendered as a hover card (the editor's Markdown hover, including code highlighting and safe links) while the pointer rests on the range or its -`after` label. `hover` remains the plain-text fallback. A plugin that pushes +`after` label. `hover` remains the plain-text fallback. API 1.17 adds +`set_styled_decorations`: those items plus `colors` (`foreground` / `background`, +each `#rrggbb` or `#rrggbbaa`). Palette styles follow the theme; use colors only +when the user chose them (or the plugin's own data defines them), since they do not +adapt to light and dark themes. The line-end `after` label takes the foreground only. A plugin that pushes labels when a file is opened or focused should subscribe to `file-opened`/`editor-focused` and call `clear_decorations` when its data no longer applies; the host already bounds what a set can carry. diff --git a/plugins/official/ai-completion/dist/plugin.wasm b/plugins/official/ai-completion/dist/plugin.wasm index 643ba0535..c43b25109 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 f7800eb14..981094100 100644 --- a/plugins/official/ai-completion/dist/plugin.wasm.sources +++ b/plugins/official/ai-completion/dist/plugin.wasm.sources @@ -1 +1 @@ -657eb2ab2d2c0e1bffa6e5852af883d38a507341bc2d9c5879717ccaef6a4100 +25da773f6dee3c966c529d526415bbbd763c5c144660b1e2744737f2bfe0fb65 diff --git a/plugins/official/blame-annotations/dist/plugin.wasm b/plugins/official/blame-annotations/dist/plugin.wasm index e3ecee42d..3eafdcb26 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 371b8b52b..a8a25ba8a 100644 --- a/plugins/official/blame-annotations/dist/plugin.wasm.sources +++ b/plugins/official/blame-annotations/dist/plugin.wasm.sources @@ -1 +1 @@ -cab71634347487537f5310bdcb883482e94387707d57dd3eb271be378186dfff +e42622d525d315a5a5d186197e17624ec713ec1d9a47a0dbc67abfeb61854971 diff --git a/plugins/official/checkstyle/dist/plugin.wasm b/plugins/official/checkstyle/dist/plugin.wasm index 201d63cd9..c89233740 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 2da89bc14..bae2b3b39 100644 --- a/plugins/official/checkstyle/dist/plugin.wasm.sources +++ b/plugins/official/checkstyle/dist/plugin.wasm.sources @@ -1 +1 @@ -a802ccc1608628f2e97d91b5e4ba3f0d77b8addffdb7ada532d52b089c878b72 +24f75bb6f4145a4432a5dbe3dec0fbc8fb77b4bdc853f300ccd7208941d6f16d diff --git a/plugins/official/container-runner/dist/plugin.wasm b/plugins/official/container-runner/dist/plugin.wasm index adf030890..9518bbe91 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 016cac21b..09bc6a1a3 100644 --- a/plugins/official/container-runner/dist/plugin.wasm.sources +++ b/plugins/official/container-runner/dist/plugin.wasm.sources @@ -1 +1 @@ -28d398a0f606cacbab278002320dc1724d353d1e858eff290c4bbafc3f70fb92 +701df0210137656bbedab1d7af171c6442bbbce296f885ea63a21a7cf28a76aa diff --git a/plugins/official/csv-editor/dist/plugin.wasm b/plugins/official/csv-editor/dist/plugin.wasm index 6e3c1e632..fc03b52ec 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 e33ee8691..2c09b96ca 100644 --- a/plugins/official/csv-editor/dist/plugin.wasm.sources +++ b/plugins/official/csv-editor/dist/plugin.wasm.sources @@ -1 +1 @@ -a2ec37204138e764dde32a021bedb4cb2b79e8905c48d5912ca356f98d8e7439 +d1dae995f46af06e43a21e57b9ad4af31854e7e87c5f120d7b516940ea6bba99 diff --git a/plugins/official/git-toolbox/dist/plugin.wasm b/plugins/official/git-toolbox/dist/plugin.wasm index f9056aaaa..987c97c59 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 1ef07f01d..aef6c57b8 100644 --- a/plugins/official/git-toolbox/dist/plugin.wasm.sources +++ b/plugins/official/git-toolbox/dist/plugin.wasm.sources @@ -1 +1 @@ -07fb659ac6daf89956cfeb51073f95cdc65fa801f2de62bdfa12b5ef0c72e08f +7e50407014ba5c0a0d22a1d5c92dff8180e20f153101c9a9a18c83e0ec16cbfe diff --git a/plugins/official/graphviz/dist/plugin.wasm b/plugins/official/graphviz/dist/plugin.wasm index d06bb1b7a..141bd659b 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 fa4464f7f..2d2f8c5e6 100644 --- a/plugins/official/graphviz/dist/plugin.wasm.sources +++ b/plugins/official/graphviz/dist/plugin.wasm.sources @@ -1 +1 @@ -f2feddc2ca41706ff859f82081541832b3b3c3501c2deefb266faadcc4833b5a +c58f9d017da99a14b127c51c0ad9ceaa7fd6d1138732d68604653fb0ff97de6b diff --git a/plugins/official/key-promoter/dist/plugin.wasm b/plugins/official/key-promoter/dist/plugin.wasm index de7b30621..343665710 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 0a9069374..192fc3b95 100644 --- a/plugins/official/key-promoter/dist/plugin.wasm.sources +++ b/plugins/official/key-promoter/dist/plugin.wasm.sources @@ -1 +1 @@ -563d9d1f3e3760bdc2094f10b630108ca6680636d46c1e7d04105434547c5309 +828ad3a4a9b7e8a9d938a68883254b4eb572309ef48bb11c9155915047d007e2 diff --git a/plugins/official/license-header/dist/plugin.wasm b/plugins/official/license-header/dist/plugin.wasm index 579dfd96c..9f1c8eb05 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 0922f07be..065faca89 100644 --- a/plugins/official/license-header/dist/plugin.wasm.sources +++ b/plugins/official/license-header/dist/plugin.wasm.sources @@ -1 +1 @@ -4b512f5486462cabad280f2f9b1c9fa37fb394935721e9b8bdd6e2136faf4e11 +1e60cbca93fd8a361705bd92cf8e187f857897c3763bda52eb6f33a58d16262f diff --git a/plugins/official/mybatis/dist/plugin.wasm b/plugins/official/mybatis/dist/plugin.wasm index 25bafa1cf..02c53824d 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 5efae3ad9..2f9340a60 100644 --- a/plugins/official/mybatis/dist/plugin.wasm.sources +++ b/plugins/official/mybatis/dist/plugin.wasm.sources @@ -1 +1 @@ -38efacb96fdcf886c60a3b0028628d112d0859d5a6ca6d765ca16e3151f323e2 +be647f1d778223bb5cc63daebfa71085c3f20c0624b2db53d6870bbfa2c190e0 diff --git a/plugins/official/regex-tester/dist/plugin.wasm b/plugins/official/regex-tester/dist/plugin.wasm index 0b54887e0..ed7f13fc5 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 bd6710db2..a70e8ea90 100644 --- a/plugins/official/regex-tester/dist/plugin.wasm.sources +++ b/plugins/official/regex-tester/dist/plugin.wasm.sources @@ -1 +1 @@ -3dba1e7d6992ce9847a59ef3cf486f0bacee0d24629544445f056ea9ea8cbc83 +37e3ecf2c02b08a488a0c2a949a23756470d1edd9a3ee8c00bfefaca82ed87ad diff --git a/plugins/official/solidity/dist/plugin.wasm b/plugins/official/solidity/dist/plugin.wasm index 79f36fe2e..c3edeeeb1 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 df6b09493..f9512fdb9 100644 --- a/plugins/official/solidity/dist/plugin.wasm.sources +++ b/plugins/official/solidity/dist/plugin.wasm.sources @@ -1 +1 @@ -044d9fd391ba1063acfc3b32fed2cffe7398b5b96ba19c257c53b9806a98785f +33f55182b4c0e9ca455605a328cb47ffac155540589bbb0854750926cbbb5e05 diff --git a/plugins/official/string-tools/dist/plugin.wasm b/plugins/official/string-tools/dist/plugin.wasm index 08a6db1b0..d44753198 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 71f74be24..a7fed53f7 100644 --- a/plugins/official/string-tools/dist/plugin.wasm.sources +++ b/plugins/official/string-tools/dist/plugin.wasm.sources @@ -1 +1 @@ -3e739b326a76f9f7788e228dbabaf90e22d6170fa88284a41d5893bd1f605363 +e62e3c647e6b175ce66ab18ee1e1451be486fa5c3b586b4d508063c8d7b08fec diff --git a/plugins/official/test-runner/dist/plugin.wasm b/plugins/official/test-runner/dist/plugin.wasm index 040e3ac01..c47822210 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 de360eb47..5d29c1d14 100644 --- a/plugins/official/test-runner/dist/plugin.wasm.sources +++ b/plugins/official/test-runner/dist/plugin.wasm.sources @@ -1 +1 @@ -de8e4453fa010ed628e7458cc7526ce708cd9cba045506468cc1c8b3af6aa33e +f96c4d0de92a1ac3f363b936035f413643535ba30ec7752be85caccc28af167f diff --git a/plugins/official/todo-finder/dist/plugin.wasm b/plugins/official/todo-finder/dist/plugin.wasm index e1479852a..47c46a6f4 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 da11383b8..5533be182 100644 --- a/plugins/official/todo-finder/dist/plugin.wasm.sources +++ b/plugins/official/todo-finder/dist/plugin.wasm.sources @@ -1 +1 @@ -94be23d0f39ed345eb6e46f4c80200de01835353bac269921bb6e10bfc6a50ae +3b8a2d8b44637f5e951d42eb8932a64a347bbcea82e7ddbbc707cbc9cea2f320 diff --git a/sdk/rust/openidea-plugin/src/host.rs b/sdk/rust/openidea-plugin/src/host.rs index 955ac0d38..7c1046959 100644 --- a/sdk/rust/openidea-plugin/src/host.rs +++ b/sdk/rust/openidea-plugin/src/host.rs @@ -467,6 +467,23 @@ mod imp { .collect::>(); wit::decorations::set_markdown(path, set, &items).map_err(error) } + pub fn set_styled_decorations(path: &str, set: &str, items: &[StyledDecoration]) -> Result<(), Error> { + let items = items + .iter() + .map(|d| wit::decorations::StyledDecoration { + range: range_out(d.range), + style: d.style.clone(), + hover: d.hover.clone(), + after: d.after.clone(), + markdown_hover: d.markdown_hover.clone(), + colors: d.colors.as_ref().map(|c| wit::decorations::DecorationColors { + foreground: c.foreground.clone(), + background: c.background.clone(), + }), + }) + .collect::>(); + wit::decorations::set_styled(path, set, &items).map_err(error) + } pub fn clear_decorations(set: &str) -> Result<(), Error> { wit::decorations::clear(set).map_err(error) } @@ -2111,6 +2128,12 @@ pub fn set_decorations(path: &str, set: &str, items: &[Decoration]) -> Result<() pub fn set_markdown_decorations(path: &str, set: &str, items: &[MarkdownDecoration]) -> Result<(), Error> { imp::set_markdown_decorations(path, set, items) } +/// Replace a file's editor decorations with items that carry their own `#rrggbb` / `#rrggbbaa` +/// foreground and background (API 1.17); an item may leave `style` empty when it has colors. +/// Requires project.read; the same limits and set ids as [`set_decorations`]. +pub fn set_styled_decorations(path: &str, set: &str, items: &[StyledDecoration]) -> Result<(), Error> { + imp::set_styled_decorations(path, set, items) +} /// Clear this plugin's editor decoration set in all projects. Requires project.read. pub fn clear_decorations(set: &str) -> Result<(), Error> { imp::clear_decorations(set) diff --git a/sdk/rust/openidea-plugin/src/lib.rs b/sdk/rust/openidea-plugin/src/lib.rs index 4b431cd38..8bb324479 100644 --- a/sdk/rust/openidea-plugin/src/lib.rs +++ b/sdk/rust/openidea-plugin/src/lib.rs @@ -114,7 +114,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.16.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/types@1.17.0": crate::bindings::openidea::plugin::types, }, }); } @@ -131,7 +131,7 @@ pub mod providers_bindings { export_macro_name: "__export_editor_providers_world", default_bindings_module: "openidea_plugin::providers_bindings", with: { - "openidea:plugin/types@1.16.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/types@1.17.0": crate::bindings::openidea::plugin::types, }, }); } @@ -148,10 +148,10 @@ pub mod views_bindings { export_macro_name: "__export_views_world", default_bindings_module: "openidea_plugin::views_bindings", with: { - "openidea:plugin/types@1.16.0": crate::bindings::openidea::plugin::types, - "openidea:plugin/workspace@1.16.0": crate::bindings::openidea::plugin::workspace, - "openidea:plugin/editor@1.16.0": crate::bindings::openidea::plugin::editor, - "openidea:plugin/invocation@1.16.0": crate::bindings::openidea::plugin::invocation, + "openidea:plugin/types@1.17.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/workspace@1.17.0": crate::bindings::openidea::plugin::workspace, + "openidea:plugin/editor@1.17.0": crate::bindings::openidea::plugin::editor, + "openidea:plugin/invocation@1.17.0": crate::bindings::openidea::plugin::invocation, }, }); } @@ -163,7 +163,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.16.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.17.0": crate::bindings::openidea::plugin::types }, }); } @@ -175,10 +175,10 @@ pub mod details_bindings { export_macro_name: "__export_details_world", default_bindings_module: "openidea_plugin::details_bindings", with: { - "openidea:plugin/types@1.16.0": crate::bindings::openidea::plugin::types, - "openidea:plugin/workspace@1.16.0": crate::bindings::openidea::plugin::workspace, - "openidea:plugin/editor@1.16.0": crate::bindings::openidea::plugin::editor, - "openidea:plugin/invocation@1.16.0": crate::bindings::openidea::plugin::invocation, + "openidea:plugin/types@1.17.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/workspace@1.17.0": crate::bindings::openidea::plugin::workspace, + "openidea:plugin/editor@1.17.0": crate::bindings::openidea::plugin::editor, + "openidea:plugin/invocation@1.17.0": crate::bindings::openidea::plugin::invocation, }, }); } @@ -190,7 +190,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.16.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.17.0": crate::bindings::openidea::plugin::types }, }); } @@ -202,8 +202,8 @@ pub mod diagnostics_bindings { export_macro_name: "__export_diagnostics_world", default_bindings_module: "openidea_plugin::diagnostics_bindings", with: { - "openidea:plugin/types@1.16.0": crate::bindings::openidea::plugin::types, - "openidea:plugin/diagnostics@1.16.0": crate::bindings::openidea::plugin::diagnostics, + "openidea:plugin/types@1.17.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/diagnostics@1.17.0": crate::bindings::openidea::plugin::diagnostics, }, }); } @@ -215,7 +215,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.16.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.17.0": crate::bindings::openidea::plugin::types }, }); } @@ -227,11 +227,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.16.0": crate::bindings::openidea::plugin::types, - "openidea:plugin/workspace@1.16.0": crate::bindings::openidea::plugin::workspace, - "openidea:plugin/editor@1.16.0": crate::bindings::openidea::plugin::editor, - "openidea:plugin/invocation@1.16.0": crate::bindings::openidea::plugin::invocation, - "openidea:plugin/commit@1.16.0": crate::bindings::openidea::plugin::commit, + "openidea:plugin/types@1.17.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/workspace@1.17.0": crate::bindings::openidea::plugin::workspace, + "openidea:plugin/editor@1.17.0": crate::bindings::openidea::plugin::editor, + "openidea:plugin/invocation@1.17.0": crate::bindings::openidea::plugin::invocation, + "openidea:plugin/commit@1.17.0": crate::bindings::openidea::plugin::commit, }, }); } @@ -243,7 +243,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.16.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.17.0": crate::bindings::openidea::plugin::types }, }); } @@ -254,7 +254,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.16.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.17.0": crate::bindings::openidea::plugin::types }, }); } @@ -266,10 +266,10 @@ pub mod endpoints_bindings { export_macro_name: "__export_endpoints_world", default_bindings_module: "openidea_plugin::endpoints_bindings", with: { - "openidea:plugin/types@1.16.0": crate::bindings::openidea::plugin::types, - "openidea:plugin/workspace@1.16.0": crate::bindings::openidea::plugin::workspace, - "openidea:plugin/editor@1.16.0": crate::bindings::openidea::plugin::editor, - "openidea:plugin/invocation@1.16.0": crate::bindings::openidea::plugin::invocation, + "openidea:plugin/types@1.17.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/workspace@1.17.0": crate::bindings::openidea::plugin::workspace, + "openidea:plugin/editor@1.17.0": crate::bindings::openidea::plugin::editor, + "openidea:plugin/invocation@1.17.0": crate::bindings::openidea::plugin::invocation, }, }); } @@ -282,16 +282,16 @@ pub mod search_bindings { export_macro_name: "__export_search_world", default_bindings_module: "openidea_plugin::search_bindings", with: { - "openidea:plugin/types@1.16.0": crate::bindings::openidea::plugin::types, - "openidea:plugin/workspace@1.16.0": crate::bindings::openidea::plugin::workspace, - "openidea:plugin/editor@1.16.0": crate::bindings::openidea::plugin::editor, - "openidea:plugin/invocation@1.16.0": crate::bindings::openidea::plugin::invocation, + "openidea:plugin/types@1.17.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/workspace@1.17.0": crate::bindings::openidea::plugin::workspace, + "openidea:plugin/editor@1.17.0": crate::bindings::openidea::plugin::editor, + "openidea:plugin/invocation@1.17.0": crate::bindings::openidea::plugin::invocation, }, }); } /// The plugin API version this SDK targets. -pub const API_VERSION: &str = "1.16"; +pub const API_VERSION: &str = "1.17"; /// A plugin. One instance lives as long as the plugin's Wasm instance (until /// it is disabled, crashes or is reclaimed when idle). @@ -1539,7 +1539,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.16.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.17.0": crate::bindings::openidea::plugin::types }, }); } #[cfg(target_arch = "wasm32")] @@ -1547,7 +1547,7 @@ pub mod launch_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.16.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.17.0": crate::bindings::openidea::plugin::types }, }); } #[doc(hidden)] @@ -1597,7 +1597,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.16.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.17.0": crate::bindings::openidea::plugin::types }, }); } @@ -1629,7 +1629,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.16.0": crate::bindings::openidea::plugin::types }, + with: { "openidea:plugin/types@1.17.0": crate::bindings::openidea::plugin::types }, }); } @@ -1659,8 +1659,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.16.0": crate::bindings::openidea::plugin::types, - "openidea:plugin/invocation@1.16.0": crate::bindings::openidea::plugin::invocation, + "openidea:plugin/types@1.17.0": crate::bindings::openidea::plugin::types, + "openidea:plugin/invocation@1.17.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 0de6c884e..86e4af980 100644 --- a/sdk/rust/openidea-plugin/src/mock.rs +++ b/sdk/rust/openidea-plugin/src/mock.rs @@ -162,6 +162,7 @@ struct State { restricted: bool, decorations: BTreeMap<(String, String), Vec>, markdown_decorations: BTreeMap<(String, String), Vec>, + styled_decorations: BTreeMap<(String, String), Vec>, file_decorations: BTreeMap<(String, String), FileDecoration>, file_notes: BTreeMap<(String, String), (String, Option)>, file_icons: BTreeMap<(String, String), (String, Option)>, @@ -328,6 +329,10 @@ impl MockHost { pub fn markdown_decorations(&self) -> BTreeMap<(String, String), Vec> { self.state.borrow().markdown_decorations.clone() } + /// Styled decoration snapshots (API 1.17) keyed by (set id, absolute path), colors normalized. + pub fn styled_decorations(&self) -> BTreeMap<(String, String), Vec> { + self.state.borrow().styled_decorations.clone() + } /// Tree decoration snapshots keyed by (set id, absolute path). pub fn file_decorations(&self) -> BTreeMap<(String, String), FileDecoration> { self.state.borrow().file_decorations.clone() @@ -1785,56 +1790,86 @@ pub mod current { | "muted" ) } + /// Plain, Markdown and styled sets share the set-id namespace and the per-file limit: the last + /// call for a (set, path) replaces whichever kind was there. + fn replace_decorations( + s: &mut State, + set: &str, + path: &str, + insert: impl FnOnce(&mut State, (String, String)), + ) -> Result<(), Error> { + fn per_file(map: &BTreeMap<(String, String), Vec>, path: &str) -> usize { + map.iter().filter(|((_, p), _)| p == path).map(|(_, i)| i.len()).sum() + } + let key = (set.to_owned(), path.to_owned()); + let saved = (s.decorations.clone(), s.markdown_decorations.clone(), s.styled_decorations.clone()); + s.decorations.remove(&key); + s.markdown_decorations.remove(&key); + s.styled_decorations.remove(&key); + insert(s, key); + let names = (s.decorations.keys()) + .chain(s.markdown_decorations.keys()) + .chain(s.styled_decorations.keys()) + .map(|(set, _)| set) + .collect::>() + .len(); + let count = per_file(&s.decorations, path) + + per_file(&s.markdown_decorations, path) + + per_file(&s.styled_decorations, path); + if set.is_empty() || set.len() > 128 || names > 50 || count > 10_000 { + (s.decorations, s.markdown_decorations, s.styled_decorations) = saved; + return Err(Error::Invalid("decoration limit".into())); + } + Ok(()) + } pub fn set_decorations(path: &str, set: &str, items: &[Decoration]) -> Result<(), Error> { with(|s| { require(s, "project.read")?; let path = decoration_path(s, path)?; - let mut next = s.decorations.clone(); - next.insert((set.into(), path.clone()), items.iter().filter(|d| style(&d.style)).cloned().collect()); - // Plain and Markdown sets share the set-id namespace: the last call wins. - let mut markdown = s.markdown_decorations.clone(); - markdown.remove(&(set.into(), path.clone())); - let names: BTreeSet<_> = next.keys().chain(markdown.keys()).map(|(set, _)| set).collect(); - let counts = |map: &BTreeMap<(String, String), Vec>| -> usize { - map.iter().filter(|((_, p), _)| *p == path).map(|(_, i)| i.len()).sum() - }; - let markdown_counts = |map: &BTreeMap<(String, String), Vec>| -> usize { - map.iter().filter(|((_, p), _)| *p == path).map(|(_, i)| i.len()).sum() - }; - if set.is_empty() - || set.len() > 128 - || names.len() > 50 - || counts(&next) + markdown_counts(&markdown) > 10_000 - { - return Err(Error::Invalid("decoration limit".into())); - } - s.decorations = next; - s.markdown_decorations = markdown; - Ok(()) + let items = items.iter().filter(|d| style(&d.style)).cloned().collect(); + replace_decorations(s, set, &path, |s, key| { + s.decorations.insert(key, items); + }) }) } pub fn set_markdown_decorations(path: &str, set: &str, items: &[MarkdownDecoration]) -> Result<(), Error> { with(|s| { require(s, "project.read")?; let path = decoration_path(s, path)?; - let mut next = s.markdown_decorations.clone(); - next.insert((set.into(), path.clone()), items.iter().filter(|d| style(&d.style)).cloned().collect()); - // Plain and Markdown sets share the set-id namespace: the last call wins. - let mut plain = s.decorations.clone(); - plain.remove(&(set.into(), path.clone())); - let names: BTreeSet<_> = next.keys().chain(plain.keys()).map(|(set, _)| set).collect(); - let counts = |map: &BTreeMap<(String, String), Vec>| -> usize { - map.iter().filter(|((_, p), _)| *p == path).map(|(_, i)| i.len()).sum() - }; - let plain_counts = |map: &BTreeMap<(String, String), Vec>| -> usize { - map.iter().filter(|((_, p), _)| *p == path).map(|(_, i)| i.len()).sum() - }; - if set.is_empty() || set.len() > 128 || names.len() > 50 || counts(&next) + plain_counts(&plain) > 10_000 { - return Err(Error::Invalid("decoration limit".into())); + let items = items.iter().filter(|d| style(&d.style)).cloned().collect(); + replace_decorations(s, set, &path, |s, key| { + s.markdown_decorations.insert(key, items); + }) + }) + } + /// The host's color rule: `#rrggbb` or `#rrggbbaa`, stored lower case. + fn color(color: &str) -> Result { + let hex = color.strip_prefix('#').unwrap_or(""); + if (hex.len() == 6 || hex.len() == 8) && hex.bytes().all(|b| b.is_ascii_hexdigit()) { + Ok(format!("#{}", hex.to_ascii_lowercase())) + } else { + Err(Error::Invalid(format!("decoration color '{color}' is not #rrggbb or #rrggbbaa"))) + } + } + pub fn set_styled_decorations(path: &str, set: &str, items: &[StyledDecoration]) -> Result<(), Error> { + with(|s| { + require(s, "project.read")?; + let path = decoration_path(s, path)?; + let mut kept = Vec::new(); + for item in items { + let mut item = item.clone(); + if let Some(c) = &mut item.colors { + c.foreground = c.foreground.as_deref().map(color).transpose()?; + c.background = c.background.as_deref().map(color).transpose()?; + } + item.colors = item.colors.filter(|c| c.foreground.is_some() || c.background.is_some()); + if style(&item.style) || (item.style.is_empty() && item.colors.is_some()) { + kept.push(item); + } } - s.decorations = plain; - s.markdown_decorations = next; - Ok(()) + replace_decorations(s, set, &path, |s, key| { + s.styled_decorations.insert(key, kept); + }) }) } pub fn clear_decorations(set: &str) -> Result<(), Error> { @@ -1842,6 +1877,7 @@ pub mod current { require(s, "project.read")?; s.decorations.retain(|(id, _), _| id != set); s.markdown_decorations.retain(|(id, _), _| id != set); + s.styled_decorations.retain(|(id, _), _| id != set); Ok(()) }) } diff --git a/sdk/rust/openidea-plugin/src/types.rs b/sdk/rust/openidea-plugin/src/types.rs index c29928df2..abe25eec4 100644 --- a/sdk/rust/openidea-plugin/src/types.rs +++ b/sdk/rust/openidea-plugin/src/types.rs @@ -850,6 +850,23 @@ pub struct MarkdownDecoration { pub after: Option, pub markdown_hover: Option, } +/// An editor decoration's own colors (API 1.17): `#rrggbb` or `#rrggbbaa`. +#[derive(Clone, Debug, Default, PartialEq, Eq)] +pub struct DecorationColors { + pub foreground: Option, + pub background: Option, +} +/// An editor annotation with its own colors (API 1.17). `style` may be empty when `colors` are set; +/// otherwise it is a palette name and the colors paint over it. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct StyledDecoration { + pub range: Range, + pub style: String, + pub hover: Option, + pub after: Option, + pub markdown_hover: Option, + pub colors: Option, +} /// A project-tree annotation. Badge is at most two Unicode characters. #[derive(Clone, Debug, PartialEq, Eq)] pub struct FileDecoration { diff --git a/sdk/rust/openidea-plugin/tests/api17_styled_decorations.rs b/sdk/rust/openidea-plugin/tests/api17_styled_decorations.rs new file mode 100644 index 000000000..b1893293c --- /dev/null +++ b/sdk/rust/openidea-plugin/tests/api17_styled_decorations.rs @@ -0,0 +1,63 @@ +use openidea_plugin::{Decoration, DecorationColors, Error, Range, StyledDecoration, host, mock::MockHost}; + +fn styled(style: &str, foreground: Option<&str>, background: Option<&str>) -> StyledDecoration { + StyledDecoration { + range: Range::default(), + style: style.into(), + hover: Some("TODO".into()), + after: None, + markdown_hover: None, + colors: Some(DecorationColors { + foreground: foreground.map(Into::into), + background: background.map(Into::into), + }), + } +} + +#[test] +fn styled_decorations_validate_and_normalize_colors() { + let mock = MockHost::install(); + host::set_styled_decorations( + "a.txt", + "todo", + &[ + styled("", Some("#1A1A1A"), Some("#FFEB3B80")), + styled("highlight", None, Some("#00e5ff")), + styled("", None, None), + StyledDecoration { colors: None, ..styled("", None, None) }, + ], + ) + .unwrap(); + let items = mock.styled_decorations().into_values().next().unwrap(); + assert_eq!(items.len(), 2, "an empty style needs colors"); + assert_eq!( + items[0].colors, + Some(DecorationColors { foreground: Some("#1a1a1a".into()), background: Some("#ffeb3b80".into()) }) + ); + for bad in ["red", "#fff", "#12345g", "rgb(0,0,0)", "#ffffff; x: y"] { + let err = host::set_styled_decorations("a.txt", "todo", &[styled("", Some(bad), None)]).unwrap_err(); + assert!(matches!(err, Error::Invalid(ref m) if m.contains("#rrggbb")), "{bad}: {err:?}"); + } + assert_eq!(mock.styled_decorations().into_values().next().unwrap().len(), 2, "a rejected call changes nothing"); +} + +#[test] +fn styled_sets_share_ids_and_limits_with_plain_sets() { + let mock = MockHost::install(); + let plain = Decoration { range: Range::default(), style: "highlight".into(), hover: None, after: None }; + host::set_decorations("a.txt", "todo", &[plain]).unwrap(); + host::set_styled_decorations("a.txt", "todo", &[styled("", Some("#000000"), None)]).unwrap(); + assert!(mock.decorations().is_empty(), "the last call for a set id wins"); + assert_eq!(mock.styled_decorations().len(), 1); + for i in 0..49 { + host::set_decorations("a.txt", &format!("set{i}"), &[]).unwrap(); + } + assert!(host::set_styled_decorations("a.txt", "overflow", &[]).is_err()); + host::clear_decorations("todo").unwrap(); + assert!(mock.styled_decorations().is_empty()); + let _mock = mock.with_capabilities(&[]); + assert!(matches!( + host::set_styled_decorations("a.txt", "todo", &[]), + Err(Error::Denied(c)) if c == "project.read" + )); +} diff --git a/sdk/rust/openidea-plugin/wit/commit.wit b/sdk/rust/openidea-plugin/wit/commit.wit index 1cd5db535..076a52f79 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.16.0; +package openidea:plugin@1.17.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 5a8ea6dee..69cb45147 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.16.0; +package openidea:plugin@1.17.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 9caa23a5f..8c13b7da3 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.16.0; +package openidea:plugin@1.17.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 fbf5755f2..0bc2d2567 100644 --- a/sdk/rust/openidea-plugin/wit/decorations.wit +++ b/sdk/rust/openidea-plugin/wit/decorations.wit @@ -1,10 +1,11 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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. /// Tree sets are rooted in an open project. Sets belong to the plugin and disappear when it stops. /// Styles: highlight, search, added, modified, removed, warning, error, info, -/// typo, weak, underline, strikethrough, muted. Unknown styles are ignored. Theme tokens only. +/// typo, weak, underline, strikethrough, muted. Unknown styles are ignored. Theme tokens only, +/// except for the colors a `set-styled` item gives (API 1.17). interface decorations { use types.{error, range}; /// An editor annotation; after is plain text shown after the range. @@ -20,6 +21,22 @@ interface decorations { /// the range or its after label. markdown-hover: option, } + /// Colors of a styled decoration (API 1.17): `#rrggbb`, or `#rrggbbaa` with an alpha + /// (`ff` fully opaque). An absent color keeps the style's own. + record decoration-colors { + foreground: option, + background: option, + } + /// An editor annotation with its own colors (API 1.17). `style` may be empty when + /// `colors` is set: the range then shows only those colors. + record styled-decoration { + range: range, + style: string, + hover: option, + after: option, + markdown-hover: option, + colors: option, + } /// A project-tree annotation; badge is at most two Unicode characters. record file-decoration { badge: option, style: string, tooltip: option } /// Replace this set for a file. At most 10,000 items/file and 50 editor sets/plugin. @@ -29,6 +46,10 @@ interface decorations { /// (API 1.16). Same limits and set-id replacement rules as `set`; `clear` /// removes a set regardless of which call created it. set-markdown: func(path: string, set-id: string, items: list) -> result<_, error>; + /// Like `set-markdown`, with each item's own colors (API 1.17): for highlights a plugin + /// assigns, such as one color per marked variable. Colors apply only to the item's range + /// and after label; an invalid color fails the call. Same limits and set-id rules as `set`. + set-styled: func(path: string, set-id: string, items: list) -> result<_, error>; /// Remove this editor set from every file/project. clear: func(set-id: string) -> result<_, error>; /// Replace this set's tree annotation for a file; at most 50 tree sets/plugin. diff --git a/sdk/rust/openidea-plugin/wit/details.wit b/sdk/rust/openidea-plugin/wit/details.wit index d9f7e8519..a8203d6e3 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.16.0; +package openidea:plugin@1.17.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 99182157b..8406c6b9d 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.16.0; +package openidea:plugin@1.17.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 1337245f6..b886c9299 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.16.0; +package openidea:plugin@1.17.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 dbb6f85aa..08ec256ee 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.16.0; +package openidea:plugin@1.17.0; /// Workbench events, delivered in batches to `event-handler.handle`. interface events { diff --git a/sdk/rust/openidea-plugin/wit/exports.wit b/sdk/rust/openidea-plugin/wit/exports.wit index 2231df834..ca9993fee 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.16.0; +package openidea:plugin@1.17.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 62ad14e7d..2386aa6d3 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.16.0; +package openidea:plugin@1.17.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 4604c6d7e..305240728 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.16.0; +package openidea:plugin@1.17.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 3c5220d1a..edafbaa91 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.16.0; +package openidea:plugin@1.17.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 dca0e58ba..2f95d00b4 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.16.0; +package openidea:plugin@1.17.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 451d3fc77..af7834d25 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.16.0; +package openidea:plugin@1.17.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 c377f794c..4e234cf02 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.16.0; +package openidea:plugin@1.17.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 1991c6131..5aa412760 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.16.0; +package openidea:plugin@1.17.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 bb61716cb..3c8bd398c 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.16.0; +package openidea:plugin@1.17.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 a18ea2d1f..b70161adc 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.16.0; +package openidea:plugin@1.17.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 e4f0b298f..b2e1ee48c 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.16.0; +package openidea:plugin@1.17.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 21c6fec7b..9139f996d 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.16.0; +package openidea:plugin@1.17.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 d4cca14fb..cd89f46e5 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.16.0; +package openidea:plugin@1.17.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 b2ddeaaac..5bd777979 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.16.0; +package openidea:plugin@1.17.0; world plugin { import log; diff --git a/sdk/rust/openidea-plugin/wit/providers.wit b/sdk/rust/openidea-plugin/wit/providers.wit index ff18f8530..6af8144a2 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.16.0; +package openidea:plugin@1.17.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 f8ddcf0c9..ef97b7208 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.16.0; +package openidea:plugin@1.17.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 9ad3c9f22..1d129aaea 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.16.0; +package openidea:plugin@1.17.0; /// Launches this plugin's configurations in the invoking window's Run tool window. interface run { diff --git a/sdk/rust/openidea-plugin/wit/search.wit b/sdk/rust/openidea-plugin/wit/search.wit index c9793aca4..130f9e462 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.16.0; +package openidea:plugin@1.17.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 49ff34c70..314ffff8d 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.16.0; +package openidea:plugin@1.17.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/types.wit b/sdk/rust/openidea-plugin/wit/types.wit index c4b9a4302..8d84dbe11 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.16.0; +package openidea:plugin@1.17.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 576d55d15..704d25e49 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.16.0; +package openidea:plugin@1.17.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 10edb951c..1b496eaf3 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.16.0; +package openidea:plugin@1.17.0; interface workspace { use types.{error, location}; diff --git a/src/bindings.ts b/src/bindings.ts index 9c75152f1..3f55289b8 100644 --- a/src/bindings.ts +++ b/src/bindings.ts @@ -5807,6 +5807,14 @@ export type Decoration = { * plain-text fallback shown when this is absent. */ markdownHover: string | null, + /** The item's own colors (API 1.17 `set-styled`), validated `#rrggbb` / `#rrggbbaa`. */ + colors?: DecorationColors | null, +}; + +/** Colors of a styled editor decoration (API 1.17). */ +export type DecorationColors = { + foreground: string | null, + background: string | null, }; /** A plugin-owned editor or project-tree decoration set for one file. */ diff --git a/src/features/plugins/__tests__/decorations.test.ts b/src/features/plugins/__tests__/decorations.test.ts index 441bee115..6446c1322 100644 --- a/src/features/plugins/__tests__/decorations.test.ts +++ b/src/features/plugins/__tests__/decorations.test.ts @@ -287,6 +287,37 @@ it("filters tree badges by project root but not editor annotations, and drops un expect(getFileDecoration("/p/a.txt")?.badge).toBeUndefined(); }); +it("paints a styled item's own colors, with or without a palette style", () => { + const styled = set(); + styled.items = [ + { ...styled.items[0]!, style: "", hover: "own", colors: { foreground: "#1a1a1a", background: "#ffeb3b80" } }, + { + ...styled.items[0]!, + range: { start: { line: 0, col: 4 }, end: { line: 0, col: 6 } }, + hover: "palette", + after: null, + colors: { foreground: null, background: "#00e5ff" }, + }, + ]; + setPluginDecorations("test", [styled]); + const own = editor.view.dom.querySelector('[title="own"]'); + expect(own?.textContent).toBe("te"); + expect(own?.style.color).toBe("rgb(26, 26, 26)"); + expect(own?.style.backgroundColor).toBe("rgba(255, 235, 59, 0.5)"); + // The line-end label takes the foreground only; the fill belongs to the code. + const label = editor.view.dom.querySelector(".cm-plugin-after")?.firstElementChild as HTMLElement; + expect(label.textContent).toBe(""); + expect(label.style.color).toBe("rgb(26, 26, 26)"); + expect(label.style.backgroundColor).toBe(""); + const palette = editor.view.dom.querySelector('[title="palette"]'); + expect(palette?.className).not.toBe(""); + expect(palette?.style.backgroundColor).toBe("rgb(0, 229, 255)"); + // An empty style without usable colors renders nothing, and colors never reach the style unchecked. + styled.items = [{ ...styled.items[0]!, colors: { foreground: "red; display: none", background: null } }]; + setPluginDecorations("test", [styled]); + expect(editor.view.dom.textContent).not.toContain(""); +}); + it("shows a tree note after the name without colouring the file", () => { const note = { ...set(), diff --git a/src/features/plugins/decorations.ts b/src/features/plugins/decorations.ts index 7af8333f2..6be7cdd57 100644 --- a/src/features/plugins/decorations.ts +++ b/src/features/plugins/decorations.ts @@ -9,7 +9,7 @@ import { type DecorationSet as CmDecorations, type Tooltip, } from "@codemirror/view"; -import type { DecorationSet, Range } from "@/bindings"; +import type { Decoration as PluginDecoration, DecorationSet, Range } from "@/bindings"; import { registerEditorContribution, useEditorRegistry, type EditorDocContext } from "@/editor/api"; import { resizableDecorationHover } from "./decorationHover"; import { highlightInto, loadMarkdown, markupToHtml, renderMarkup } from "@/editor/lsp/markdown"; @@ -133,6 +133,27 @@ function offsetOf(el: HTMLElement, property: string): number { return Number.parseFloat(getComputedStyle(el).getPropertyValue(property)) || 0; } +/** A host-validated `set-styled` color; anything else is dropped rather than injected into a style. */ +const HEX_COLOR = /^#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?$/; + +function hexColor(color: string | null | undefined): string | null { + return color && HEX_COLOR.test(color) ? color : null; +} + +/** Inline CSS for an item's own colors (API 1.17), or null. */ +function colorStyle(item: PluginDecoration, background: boolean): string | null { + const foreground = hexColor(item.colors?.foreground); + const fill = background ? hexColor(item.colors?.background) : null; + const css = [foreground && `color: ${foreground}`, fill && `background-color: ${fill}`].filter(Boolean); + return css.length ? `${css.join("; ")};` : null; +} + +/** The class an editor item renders with: a palette style, or none for an item that brings its own colors. */ +function itemClass(item: PluginDecoration): string | null { + if (Object.hasOwn(colors, item.style)) return styles[item.style] ?? ""; + return item.style === "" && colorStyle(item, true) ? "" : null; +} + class AfterText extends WidgetType { /** Last offset applied, so the observer does not rewrite the style on every keystroke. */ private appliedWidth = -1; @@ -143,6 +164,7 @@ class AfterText extends WidgetType { readonly style: string, readonly hover: string | null, readonly markdown: string | null, + readonly css: string | null = null, ) { super(); } @@ -151,7 +173,8 @@ class AfterText extends WidgetType { this.text === other.text && this.style === other.style && this.hover === other.hover && - this.markdown === other.markdown + this.markdown === other.markdown && + this.css === other.css ); } /** @@ -194,6 +217,7 @@ class AfterText extends WidgetType { const text = document.createElement("span"); text.className = `${styles.afterInner ?? ""} ${this.style}`; text.textContent = this.text; + if (this.css) text.style.cssText = this.css; // The Markdown hover card replaces the native tooltip; two would stack. if (this.hover && !this.markdown) text.title = this.hover; span.appendChild(text); @@ -252,7 +276,7 @@ function refreshedMarkdown(card: OpenHover) { for (const item of set.items) if ( item.markdownHover && - Object.hasOwn(colors, item.style) && + itemClass(item) != null && item.after === card.after && sameRange(item.range, card.range) ) @@ -340,8 +364,8 @@ export function decorationExtension(ctx: EditorDocContext) { for (const set of currentSets(sets, false)) if (!set.tree && String(set.path) === String(ctx.path)) { for (const item of set.items) { - const className = Object.hasOwn(colors, item.style) ? styles[item.style] : undefined; - if (!className) continue; + const className = itemClass(item); + if (className == null) continue; const from = offset(doc, item.range.start), to = offset(doc, item.range.end); if (from == null || to == null || from > to) continue; @@ -360,7 +384,10 @@ export function decorationExtension(ctx: EditorDocContext) { ranges.push( Decoration.mark({ class: className, - attributes: item.hover && !markdown ? { title: item.hover } : {}, + attributes: { + ...(item.hover && !markdown ? { title: item.hover } : {}), + ...(colorStyle(item, true) ? { style: colorStyle(item, true)! } : {}), + }, }).range(from, to), ); if (item.after) { @@ -370,7 +397,7 @@ export function decorationExtension(ctx: EditorDocContext) { const end = doc.lineAt(to); ranges.push( Decoration.widget({ - widget: new AfterText(item.after, className, item.hover, markdown), + widget: new AfterText(item.after, className, item.hover, markdown, colorStyle(item, false)), side: 1, }).range(end.to), ); diff --git a/wit/commit.wit b/wit/commit.wit index 1cd5db535..076a52f79 100644 --- a/wit/commit.wit +++ b/wit/commit.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 5a8ea6dee..69cb45147 100644 --- a/wit/completion-list.wit +++ b/wit/completion-list.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 9caa23a5f..8c13b7da3 100644 --- a/wit/database.wit +++ b/wit/database.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 fbf5755f2..0bc2d2567 100644 --- a/wit/decorations.wit +++ b/wit/decorations.wit @@ -1,10 +1,11 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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. /// Tree sets are rooted in an open project. Sets belong to the plugin and disappear when it stops. /// Styles: highlight, search, added, modified, removed, warning, error, info, -/// typo, weak, underline, strikethrough, muted. Unknown styles are ignored. Theme tokens only. +/// typo, weak, underline, strikethrough, muted. Unknown styles are ignored. Theme tokens only, +/// except for the colors a `set-styled` item gives (API 1.17). interface decorations { use types.{error, range}; /// An editor annotation; after is plain text shown after the range. @@ -20,6 +21,22 @@ interface decorations { /// the range or its after label. markdown-hover: option, } + /// Colors of a styled decoration (API 1.17): `#rrggbb`, or `#rrggbbaa` with an alpha + /// (`ff` fully opaque). An absent color keeps the style's own. + record decoration-colors { + foreground: option, + background: option, + } + /// An editor annotation with its own colors (API 1.17). `style` may be empty when + /// `colors` is set: the range then shows only those colors. + record styled-decoration { + range: range, + style: string, + hover: option, + after: option, + markdown-hover: option, + colors: option, + } /// A project-tree annotation; badge is at most two Unicode characters. record file-decoration { badge: option, style: string, tooltip: option } /// Replace this set for a file. At most 10,000 items/file and 50 editor sets/plugin. @@ -29,6 +46,10 @@ interface decorations { /// (API 1.16). Same limits and set-id replacement rules as `set`; `clear` /// removes a set regardless of which call created it. set-markdown: func(path: string, set-id: string, items: list) -> result<_, error>; + /// Like `set-markdown`, with each item's own colors (API 1.17): for highlights a plugin + /// assigns, such as one color per marked variable. Colors apply only to the item's range + /// and after label; an invalid color fails the call. Same limits and set-id rules as `set`. + set-styled: func(path: string, set-id: string, items: list) -> result<_, error>; /// Remove this editor set from every file/project. clear: func(set-id: string) -> result<_, error>; /// Replace this set's tree annotation for a file; at most 50 tree sets/plugin. diff --git a/wit/details.wit b/wit/details.wit index d9f7e8519..a8203d6e3 100644 --- a/wit/details.wit +++ b/wit/details.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 99182157b..8406c6b9d 100644 --- a/wit/diagnostics.wit +++ b/wit/diagnostics.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 1337245f6..b886c9299 100644 --- a/wit/endpoints.wit +++ b/wit/endpoints.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.0; /// HTTP endpoints found in a project (`[[contributes.endpoints]]`). interface endpoints-provider { diff --git a/wit/events.wit b/wit/events.wit index dbb6f85aa..08ec256ee 100644 --- a/wit/events.wit +++ b/wit/events.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.0; /// Workbench events, delivered in batches to `event-handler.handle`. interface events { diff --git a/wit/exports.wit b/wit/exports.wit index 2231df834..ca9993fee 100644 --- a/wit/exports.wit +++ b/wit/exports.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.0; interface lifecycle { use types.{context, error}; diff --git a/wit/extensions.wit b/wit/extensions.wit index 62ad14e7d..2386aa6d3 100644 --- a/wit/extensions.wit +++ b/wit/extensions.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 4604c6d7e..305240728 100644 --- a/wit/file-actions.wit +++ b/wit/file-actions.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 3c5220d1a..edafbaa91 100644 --- a/wit/fs.wit +++ b/wit/fs.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 dca0e58ba..2f95d00b4 100644 --- a/wit/host.wit +++ b/wit/host.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 451d3fc77..af7834d25 100644 --- a/wit/hover-actions.wit +++ b/wit/hover-actions.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 c377f794c..4e234cf02 100644 --- a/wit/hover.wit +++ b/wit/hover.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 1991c6131..5aa412760 100644 --- a/wit/indexing.wit +++ b/wit/indexing.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 bb61716cb..3c8bd398c 100644 --- a/wit/injections.wit +++ b/wit/injections.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 a18ea2d1f..b70161adc 100644 --- a/wit/inlay.wit +++ b/wit/inlay.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 e4f0b298f..b2e1ee48c 100644 --- a/wit/io.wit +++ b/wit/io.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 21c6fec7b..9139f996d 100644 --- a/wit/language-features.wit +++ b/wit/language-features.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 d4cca14fb..cd89f46e5 100644 --- a/wit/mcp.wit +++ b/wit/mcp.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 b2ddeaaac..5bd777979 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.16.0; +package openidea:plugin@1.17.0; world plugin { import log; diff --git a/wit/providers.wit b/wit/providers.wit index ff18f8530..6af8144a2 100644 --- a/wit/providers.wit +++ b/wit/providers.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 f8ddcf0c9..ef97b7208 100644 --- a/wit/run-targets.wit +++ b/wit/run-targets.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 9ad3c9f22..1d129aaea 100644 --- a/wit/run.wit +++ b/wit/run.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.0; /// Launches this plugin's configurations in the invoking window's Run tool window. interface run { diff --git a/wit/search.wit b/wit/search.wit index c9793aca4..130f9e462 100644 --- a/wit/search.wit +++ b/wit/search.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 49ff34c70..314ffff8d 100644 --- a/wit/semantic.wit +++ b/wit/semantic.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.0; /// Optional export (world `plugin-semantic-tokens`): semantic colouring of /// documents of the languages declared with the `semantic-tokens` provider diff --git a/wit/types.wit b/wit/types.wit index c4b9a4302..8d84dbe11 100644 --- a/wit/types.wit +++ b/wit/types.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.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 576d55d15..704d25e49 100644 --- a/wit/views.wit +++ b/wit/views.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.0; /// Declarative views: tool windows declared /// under `[[contributes.views]]` and custom editors under diff --git a/wit/workspace.wit b/wit/workspace.wit index 10edb951c..1b496eaf3 100644 --- a/wit/workspace.wit +++ b/wit/workspace.wit @@ -1,4 +1,4 @@ -package openidea:plugin@1.16.0; +package openidea:plugin@1.17.0; interface workspace { use types.{error, location};