feat(plugins): editor decorations with their own colors (API 1.17) (#5957)

Plugin API 1.17: decorations.set-styled (SDK host::set_styled_decorations) lets editor decoration items carry their own #rrggbb / #rrggbbaa foreground and background, for colors the theme palette lacks (e.g. a TODO highlighter's user-chosen colors).

- Host validates and normalizes colors (anything else is Invalid); an item with colors may leave style empty; set ids, limits and clear are shared with set / set-markdown.
- Editor paints the range with inline color / background-color; the after label takes the foreground only; the frontend re-checks the hex format.
- SDK types, wrapper and mock (shared replace/limit helper for the three decoration kinds); decorations fixture gains a styled command.
- Package openidea:[email protected].0, engine 1.17.0, components rebuilt; docs list 1.16 as shipped with 0.1.52.
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-11-26 03:40:40 +08:00
1 джерело e74edbcedc
коміт bfbc70a438
181 files changed
+618 -214

No files matched your search

+1 -1
Переглянути файл
@@ -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.
+48 -1
Переглянути файл
@@ -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<String> {
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);
+25
Переглянути файл
@@ -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
+1 -1
Переглянути файл
@@ -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.
+9
Переглянути файл
@@ -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<String>,
/// The item's own colors (API 1.17 `set-styled`), validated `#rrggbb` / `#rrggbbaa`.
#[serde(default)]
pub colors: Option<DecorationColors>,
}
/// Colors of a styled editor decoration (API 1.17).
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Type)]
pub struct DecorationColors {
pub foreground: Option<String>,
pub background: Option<String>,
}
/// A tree decoration.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)]
+23
Переглянути файл
@@ -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<bindings::openidea::plugin::decorations::StyledDecoration>,
) -> 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)
+5 -4
Переглянути файл
@@ -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());
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
68517d169bea40ca5a5426a3a05ace3389417073b9369e79157a2beb051dcfc0
98e9c2b886df177bafb68a712fc1efadc4f3a7b82e8425cd1b3f4c2355bdb785
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
6edda84fad0ee7cd56a3a28b55e6c559db7b7f6b9c8c0ca645be805b545c01e7
bb77bc0963451ca4259591bf68c72ae3eb70b1c6f855fa29dfc84d2be675404c
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
ecc6b6c52753b11521ae033a5a66c2a289119e09e07d22742203d3a13122dd97
f381b0e20520bccf5acd46b95641f5542885184352e52ec2fed3fd53665c353b
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
4ec581c69a62bbf424983e241a79d0bfdb5d025a3e86d27eea745adcb1906253
f72a53e7b800b8c5408c7ac67034821f814da7b1d66f527949450431bcf52e02
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
5fb89ee3d07e4275433ad9ad930ad781ef4f227af11aa5eb9dfc9174c015b1b8
3cd2f02738b07d9a6294025cbcc6e906716d3e91db50a6f39485df9b1d6a4ead
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
236db5a85d3e7e9fee01c3ff0b9f5e66fad7e3d64fa618a0c1c980d9e5883839
d77b80884163628791b292acc59324d3b9a7c2236034b88f87e8f56af5929a48
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
4f89bd09b571016cbb9feb0674e668aa66996997c6b53a91d1a4ffbf161083a3
5a79d35e9fc1560a39b6459312a14c27c73739fd385f6c2568f9b1c1bf8fe4a1
+6 -2
Переглянути файл
@@ -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"
+29 -2
Переглянути файл
@@ -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)
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
c5c3bac9e2b69e4957bd5049d4f560dd04faf4dfc2d7523bb7968aa29f3bdcfb
264be0e527b0cc200e2d97e982b7b297ef6181a7669506ccf09159531f91124d
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
a75758a44e255b7df3adf53e5f81b8f1283270d28f78ad0d8b358d9feea98a99
6230dce145f2cce3033c4797566cbbff8c98e5d8c85d41f9342693b19a10b638
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
7e658a971fd58b84fcadc1f4939991d5f4506936989d4c8a7302ccebc0455e9c
3d7d853fa40ce14ae6781dbf5607153c4f38b2663a31f1ca29a753e8eba79f03
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
6b7c0d8971cfd3ba1d80c5fc6428e5890c820350972597a11be4ea6f0324973f
a128c5f640b42d323059a7be1bd2e89cb9de1ea1ea635b5af4e9f69b66bfd04c
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
20e43b6ac3aaa1527874f98f4b502ef88dd4676b6096b989c7bfba7a521e723d
9e00f4bcad39a99f05c35ac66962a574f7edd5713f1aa404ef72fd7ef945d1e8
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
f879df5a331ec439c7e74af4d9c7d249477239e3a0a59d5e612548623cf5e9e2
7e0ae6bfc8217c37a68e9010920a5bd3478f654b6cfaf3f54e0ef5aacae546b8
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
de1fc37d8fd5993164e0d903a0f1b4ba15005f2a90de325d7f4b4902a363fdf1
97c4d6aaf88d552d736021e21bb1f1e1594800ceb771644eb1f3356c0efbc42a
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
367366c14b69d8f3837e731e061768ec5cb344d86fba89ced63fb196e5ca475e
5a65f921bb1f0ed0f0f10811f8960d9ea9e7ded59d5172356e7cc93f05b4bd5e
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
b7bccc7f93b409263293d2dff8a31dbdcfcdfba133815f3ff60bc70a073257de
2d148151a9b0a2ab4c479183e3d2ab07d0432d8645dbf95c0e04385ef25830d8
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
f28d85f2004adcdf4e43faa57b7a5b52ab5d8233579979062461b0c5b4c63e10
63136a78f4279b140c74ff07146b79ca2ce6c7a4fffd6176e811828aad911e0e
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
23c2c5e6e208104979e1f5b8620d2279547d372f0accf893c2d7797399fe39b0
e6bf5c74e18ab47577c1e88294fa4961fe8a1e56fb3e34fec5154dab74dfd805
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
57fc9ea26136a56fa2f502e4bb17531df3f5eed092fde1267199e2447c8fbc23
ad5a9fef07a6e9db8fe0375d0ba9d2e92247c28303876ac52db2dbf938bf96ae
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
105017e20dd7a93cecb178576f2718ccf8433a6fac027b5708d6e2121f85e27a
fdbcd1afce0d106be463ef43d31245fcb4b9e84287ede78fb8abe740ea28b247
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
ae72f5db42f508bd8faac6134f6e9a785a8fdcdda823af32cb56e5936c157bf9
c9eb17c9f7e334b05bc5104204fb12a88dceafe36dbd04510e439539f2a1d464
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
d773509ce0beebc88b769d8346aaafa39b1201d959c4afd16d680c63cef919d5
14ba72bbc8013b8e2a7f87e85a7046edc4fb4a2256f3fae3ac735241096e4428
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
1b15f24dc006f18260c746d9651cdaa2416e7871397e21f2935f50d316b88f67
91b190eb62077bde52916a09d76a474584725e73cf3acf45613aecbc8c37c421
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
8249c0aa3ab7621f5cb33e2afea6babf3370749757f0957360e5c40f0c15ff66
90b20d5ec2d36fa585e3f921672b6477c9691f184151f7059dd429fd7ccc09cf
+3 -3
Переглянути файл
@@ -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",
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
0006724d54d1acb732d2d4f77d67c855b5a560747537c11eb48cb0cb988d9783
0f7fc3035725b0262925b9e062bb72bf1e875eab4aa1eb040df4c1708db7c4bd
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
5985abd096cf5d957f17302ecd9d785fbc975e409b945c3b5c7ef84b2890e6b0
0dc9ad2f7c8c73c92e36cf709e5275d13ed4f5067b1322f0a76160ff92bf8bdc
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
5e0ee5752d6c418b96b7dd3f0bfaea3e034eb868d4edb847b42cc8c33eef1257
6e17ea89659c70e925075d2825d34c61252ab511ccb2bdbad7af29d76b97b84e
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
281c04d6fb2999a6f4967475fa19dd9f0ee887c7cf2b323951f124562ea27389
2d221e76206dac71941d749626700537e003642fc862934e832366f73b862831
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
ca75434712f4f1709943a84f7bb8907479395109d1e160171314fcf768c73ef8
b6ac119e4a85cf0c53bce81d1fe70a3c086c7c3764f1cbc6bd19878da124cc97
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
51d29c00405b9e364755dec2ce22eeaaa3b06ef5218244179be73e8ab03e815f
c71e5ea2112f545be3b3c1afadd20c46f931632ee78feeb06e0945a550bc76d3
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
5e9db81302adfaab77c1cf6545cdc2cd7b0b1bed29e68ed8160b487694da043a
1b29775537e80017a5d1e5999bbc611204c696f0951818664533b51e3903f3d6
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
e66d84009ab855107a8614a146e3e21c34a767c590f2b0f10157b0546e532008
92b03822689a82c8479751af6b6dfd593ad7a1f0a8e55071819520fdccd90570
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
42e2ca709640744b0a00c0ab44911b2204417744c7402271f759ee630de79cf2
a8a8b4b2fd8f506f22734d07aa3375dca027aae9eac1d4b243997482c46561c1
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
161f4797c5a371dd3fe5e9c02a75d444c357e88db7a55e53b3cc6d22af021d38
51b39ce770af475df93655210932a43616d43653209ade5c5402183f4b63950a
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
f5e228a477aee1f902d74b532838b96cd6c07b0416037c76dfe25744724d3094
0bc832accea72dae9df6e95c985ee5ac330cb9b8fb6a0608d9ddeabcd9668610
+2 -1
Переглянути файл
@@ -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/<name>/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).
+2 -1
Переглянути файл
@@ -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/<name>/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)。
+22 -3
Переглянути файл
@@ -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:[email protected]6.0`, world
The plugin API is defined in [`wit/`](../wit/) (`openidea:[email protected]7.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.
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
657eb2ab2d2c0e1bffa6e5852af883d38a507341bc2d9c5879717ccaef6a4100
25da773f6dee3c966c529d526415bbbd763c5c144660b1e2744737f2bfe0fb65
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
cab71634347487537f5310bdcb883482e94387707d57dd3eb271be378186dfff
e42622d525d315a5a5d186197e17624ec713ec1d9a47a0dbc67abfeb61854971
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
a802ccc1608628f2e97d91b5e4ba3f0d77b8addffdb7ada532d52b089c878b72
24f75bb6f4145a4432a5dbe3dec0fbc8fb77b4bdc853f300ccd7208941d6f16d
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
28d398a0f606cacbab278002320dc1724d353d1e858eff290c4bbafc3f70fb92
701df0210137656bbedab1d7af171c6442bbbce296f885ea63a21a7cf28a76aa
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
a2ec37204138e764dde32a021bedb4cb2b79e8905c48d5912ca356f98d8e7439
d1dae995f46af06e43a21e57b9ad4af31854e7e87c5f120d7b516940ea6bba99
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
07fb659ac6daf89956cfeb51073f95cdc65fa801f2de62bdfa12b5ef0c72e08f
7e50407014ba5c0a0d22a1d5c92dff8180e20f153101c9a9a18c83e0ec16cbfe
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
f2feddc2ca41706ff859f82081541832b3b3c3501c2deefb266faadcc4833b5a
c58f9d017da99a14b127c51c0ad9ceaa7fd6d1138732d68604653fb0ff97de6b
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
563d9d1f3e3760bdc2094f10b630108ca6680636d46c1e7d04105434547c5309
828ad3a4a9b7e8a9d938a68883254b4eb572309ef48bb11c9155915047d007e2
Бінарний файл не відображається.
Loaded 100 of 181 files, more files were not shown because too many files have changed in this diff. Show more