дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 18:17:15 +02:00
feat(plugins): complete the Arguments field of a plugin's own run configurations (API 1.18) (#6213)
The optional run-configuration-completion export receives the project, the configuration's id, the field (arguments), its text and a UTF-16 caret, and answers items that each replace one UTF-16 range, so other options, quoted values and the arguments after -- stay as typed. The host completes only configurations the plugin currently provides for the window's project (also a user's override of one), keeps 200 items and gives the plugin 300 ms. In Run | Edit Configurations the field asks while typing and on Ctrl+Space, applies an item with Enter or Tab, closes the popup on Escape without closing the dialog, drops answers for text that has changed, and stays usable when the plugin fails. Fixes #4753
Цей коміт міститься в:
1 джерело
07d26722b1
коміт
0101d11ac9
134 files changed
+935
-174
No files matched your search
@@ -82,6 +82,22 @@ pub async fn plugin_run_anything_run(
|
||||
host.blocking(move || plugins.run_anything_run(&plugin_id, &window_id, root, &prefix, &line)).await
|
||||
}
|
||||
|
||||
/// Completions for a field of a plugin's own run configuration (API 1.18).
|
||||
#[command(trust = trusted)]
|
||||
pub async fn plugin_run_configuration_complete(
|
||||
host: &Host,
|
||||
plugins: &Arc<PluginHost>,
|
||||
window: &str,
|
||||
config_id: String,
|
||||
field: String,
|
||||
text: String,
|
||||
caret: u32,
|
||||
) -> IdeResult<Vec<ide_plugin::RunConfigCompletion>> {
|
||||
let (plugins, window_id) = (plugins.clone(), window.to_owned());
|
||||
let root = host.project(window)?.root.clone();
|
||||
host.blocking(move || plugins.run_configuration_complete(&window_id, &root, &config_id, &field, &text, caret)).await
|
||||
}
|
||||
|
||||
/// The UI language (BCP 47) that plugin code reads with `ui.locale()`.
|
||||
#[command(trust = always)]
|
||||
pub async fn plugin_set_ui_locale(plugins: &Arc<PluginHost>, tag: String) -> IdeResult<()> {
|
||||
@@ -350,6 +366,7 @@ ide_command::domain!(
|
||||
plugin_run_anything_run,
|
||||
plugin_run_anything_suggest,
|
||||
plugin_run_command,
|
||||
plugin_run_configuration_complete,
|
||||
plugin_select_tests,
|
||||
plugin_set_active_file,
|
||||
plugin_set_ui_locale,
|
||||
|
||||
@@ -1486,6 +1486,53 @@ impl PluginHost {
|
||||
})
|
||||
}
|
||||
|
||||
/// Completions (API 1.18) for `field` of the plugin run configuration `config_id`
|
||||
/// (`plugin:<plugin>:<id>`, also a user's override of one), as `window`'s project
|
||||
/// currently has it, for the field's `text` and UTF-16 `caret`: from what the owning
|
||||
/// plugin already knows, within 300 ms.
|
||||
pub fn run_configuration_complete(
|
||||
&self,
|
||||
window: &str,
|
||||
root: &Path,
|
||||
config_id: &str,
|
||||
field: &str,
|
||||
text: &str,
|
||||
caret: u32,
|
||||
) -> IdeResult<Vec<ide_plugin::RunConfigCompletion>> {
|
||||
if text.len() > 16 * 1024 || caret as usize > text.encode_utf16().count() || field.len() > 64 {
|
||||
return Err(IdeError::invalid("the field text or caret is out of range"));
|
||||
}
|
||||
if !self.run_detection().detect(root).iter().any(|c| c.id == config_id && c.kind == "plugin") {
|
||||
return Err(IdeError::not_found("this plugin configuration is no longer provided"));
|
||||
}
|
||||
let owner = self
|
||||
.plugins
|
||||
.read()
|
||||
.keys()
|
||||
.filter(|id| {
|
||||
config_id.strip_prefix(ide_run::EXTERNAL_PREFIX).is_some_and(|rest| rest.starts_with(&format!("{id}:")))
|
||||
})
|
||||
.max_by_key(|id| id.len())
|
||||
.cloned()
|
||||
.ok_or_else(|| IdeError::not_found("the plugin owning this configuration is not loaded"))?;
|
||||
let own = config_id[ide_run::EXTERNAL_PREFIX.len() + owner.len() + 1..].to_owned();
|
||||
let invocation = Invocation {
|
||||
client: Some(window.to_owned()),
|
||||
workspace_root: Some(root.to_path_buf()),
|
||||
..Default::default()
|
||||
};
|
||||
let (field, text) = (field.to_owned(), text.to_owned());
|
||||
let budget = Duration::from_millis(300);
|
||||
self.code_call_with_budget(
|
||||
&owner,
|
||||
invocation,
|
||||
"completing a run configuration field",
|
||||
None,
|
||||
Some(budget),
|
||||
move |rt, inv| rt.run_configuration_complete(&own, &field, &text, caret, inv, budget),
|
||||
)
|
||||
}
|
||||
|
||||
fn declared_run_anything(&self, id: &str, prefix: &str) -> IdeResult<()> {
|
||||
if self.ui.items(ui_points::RUN_ANYTHING, Some(id)).iter().any(|d| d.key == prefix) {
|
||||
Ok(())
|
||||
|
||||
@@ -39,3 +39,45 @@ fn the_plugin_suggests_and_claims_lines_of_its_prefix() {
|
||||
let ran = p.run_command(ID, "ran", None, invocation).unwrap();
|
||||
assert_eq!(ran.as_deref(), Some("build\ndocs:serve"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_plugins_configuration_completes_only_the_argument_under_the_caret() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let base = dunce::canonicalize(tmp.path()).unwrap();
|
||||
let (root, other) = (base.join("project"), base.join("other"));
|
||||
std::fs::create_dir_all(&root).unwrap();
|
||||
std::fs::create_dir_all(&other).unwrap();
|
||||
std::fs::write(root.join("Taskfile.yml"), "version: '3'\n").unwrap();
|
||||
let p = plugins(&base);
|
||||
let config = "plugin:test.run-anything:tasks";
|
||||
// Not provided until its program is approved.
|
||||
assert!(p.run_configuration_complete("main", &root, config, "arguments", "b", 1).is_err());
|
||||
p.choose_program(ID, "process:task", Some(&root), Some(Path::new("/bin/echo"))).unwrap();
|
||||
assert!(p.run_detection().detect(&root).iter().any(|c| c.id == config));
|
||||
let complete = |text: &str, caret: u32| -> Vec<(String, String, u32, u32)> {
|
||||
p.run_configuration_complete("main", &root, config, "arguments", text, caret)
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.map(|c| (c.label, c.insert, c.replace_start, c.replace_end))
|
||||
.collect()
|
||||
};
|
||||
// Options, quoted values and the task's own arguments after `--` stay outside the range.
|
||||
let text = "--dry 'a b' d -- x";
|
||||
assert_eq!(complete(text, 13), [("docs:serve".into(), "docs:serve".into(), 12, 13)]);
|
||||
assert!(complete(text, 18).is_empty(), "after `--` the arguments are the task's");
|
||||
assert!(complete(text, 3).is_empty(), "an option is not a task");
|
||||
// UTF-16 offsets.
|
||||
assert_eq!(complete("é b", 3), [("build".into(), "build".into(), 2, 3)]);
|
||||
assert_eq!(complete("", 0).len(), 3);
|
||||
assert!(p.run_configuration_complete("main", &root, config, "env", "b", 1).unwrap().is_empty());
|
||||
// Out-of-range carets, other configurations and projects without it are refused.
|
||||
assert!(p.run_configuration_complete("main", &root, config, "arguments", "b", 2).is_err());
|
||||
assert!(
|
||||
p.run_configuration_complete("main", &root, "plugin:test.run-anything:other", "arguments", "b", 1).is_err()
|
||||
);
|
||||
assert!(p.run_configuration_complete("main", &root, "npm:dev", "arguments", "b", 1).is_err());
|
||||
assert!(p.run_configuration_complete("main", &other, config, "arguments", "b", 1).is_err());
|
||||
// Revoking the program withdraws the configuration, and with it the completion.
|
||||
p.set_capability(ID, "process:task", false).unwrap();
|
||||
assert!(p.run_configuration_complete("main", &root, config, "arguments", "b", 1).is_err());
|
||||
}
|
||||
@@ -21,6 +21,7 @@ use crate::wit_host::hover_actions_bindings::exports::openidea::plugin::hover_ac
|
||||
use crate::wit_host::injections_bindings::exports::openidea::plugin::injections as wit_inj;
|
||||
use crate::wit_host::language_features_bindings::exports::openidea::plugin::language_features as wit_lf;
|
||||
use crate::wit_host::run_anything_bindings::exports::openidea::plugin::run_anything_provider as wit_ra;
|
||||
use crate::wit_host::run_config_completion_bindings::exports::openidea::plugin::run_configuration_completion as wit_rcc;
|
||||
use crate::wit_host::run_target_validation_bindings::exports::openidea::plugin::run_target_validation as wit_rtv;
|
||||
use crate::wit_host::search_bindings::exports::openidea::plugin::search_provider as wit_search;
|
||||
use crate::wit_host::{
|
||||
@@ -908,6 +909,7 @@ pub struct Runtime {
|
||||
struct Exports {
|
||||
run_target_validation: Option<wit_rtv::Guest>,
|
||||
run_anything: Option<wit_ra::Guest>,
|
||||
run_config_completion: Option<wit_rcc::Guest>,
|
||||
language_features: Option<wit_lf::Guest>,
|
||||
injections: Option<wit_inj::Guest>,
|
||||
plugin: bindings::Plugin,
|
||||
@@ -1094,6 +1096,7 @@ impl Runtime {
|
||||
let tests_indices = wit_tests::GuestIndices::new(&pre).ok();
|
||||
let validation_indices = wit_rtv::GuestIndices::new(&pre).ok();
|
||||
let run_anything_indices = wit_ra::GuestIndices::new(&pre).ok();
|
||||
let run_config_completion_indices = wit_rcc::GuestIndices::new(&pre).ok();
|
||||
let lf_indices = wit_lf::GuestIndices::new(&pre).ok();
|
||||
let inj_indices = wit_inj::GuestIndices::new(&pre).ok();
|
||||
let mcp_indices =
|
||||
@@ -1112,6 +1115,8 @@ impl Runtime {
|
||||
let run_target_validation =
|
||||
validation_indices.map(|i| i.load(&mut store, &instance)).transpose().map_err(api_hint)?;
|
||||
let run_anything = run_anything_indices.map(|i| i.load(&mut store, &instance)).transpose().map_err(api_hint)?;
|
||||
let run_config_completion =
|
||||
run_config_completion_indices.map(|i| i.load(&mut store, &instance)).transpose().map_err(api_hint)?;
|
||||
let plugin = plugin_indices.load(&mut store, &instance).map_err(api_hint)?;
|
||||
let syntax = match syntax_indices {
|
||||
Some(indices) => Some(indices.load(&mut store, &instance).map_err(api_hint)?),
|
||||
@@ -1171,6 +1176,7 @@ impl Runtime {
|
||||
exports: Exports {
|
||||
run_target_validation,
|
||||
run_anything,
|
||||
run_config_completion,
|
||||
language_features,
|
||||
injections,
|
||||
plugin,
|
||||
@@ -1245,6 +1251,39 @@ impl Runtime {
|
||||
self.call(invocation, timeout, |e, store| e.run_anything.as_ref().unwrap().call_run(store, &root, prefix, line))
|
||||
}
|
||||
|
||||
/// Completions for `field` of this plugin's configuration `config` (API 1.18); none
|
||||
/// without the export. Items whose range falls outside `text` are dropped.
|
||||
pub fn run_configuration_complete(
|
||||
&mut self,
|
||||
config: &str,
|
||||
field: &str,
|
||||
text: &str,
|
||||
caret: u32,
|
||||
invocation: Invocation,
|
||||
timeout: Duration,
|
||||
) -> Result<Vec<crate::RunConfigCompletion>, CallError> {
|
||||
if self.exports.run_config_completion.is_none() {
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
let root = invocation.workspace_root.as_deref().map(to_ipc).unwrap_or_default();
|
||||
let items = self.call(invocation, timeout, |e, store| {
|
||||
e.run_config_completion.as_ref().unwrap().call_complete(store, &root, config, field, text, caret)
|
||||
})?;
|
||||
let len = text.encode_utf16().count() as u32;
|
||||
Ok(items
|
||||
.into_iter()
|
||||
.filter(|i| i.replace_start <= i.replace_end && i.replace_end <= len)
|
||||
.take(crate::MAX_RUN_CONFIG_COMPLETIONS)
|
||||
.map(|i| crate::RunConfigCompletion {
|
||||
insert: clip(i.insert.unwrap_or_else(|| i.label.clone()), 4096),
|
||||
label: clip(i.label, MAX_TITLE),
|
||||
detail: i.detail.map(|d| clip(d, MAX_TITLE)),
|
||||
replace_start: i.replace_start,
|
||||
replace_end: i.replace_end,
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
pub fn has_run_target_validation(&self) -> bool {
|
||||
self.exports.run_target_validation.is_some()
|
||||
}
|
||||
|
||||
@@ -1142,3 +1142,18 @@ pub struct RunAnythingItem {
|
||||
/// The line Tab completes and Enter runs; `label` when absent.
|
||||
pub line: Option<String>,
|
||||
}
|
||||
|
||||
/// Most completions kept from one `run-configuration-completion.complete` answer.
|
||||
pub const MAX_RUN_CONFIG_COMPLETIONS: usize = 200;
|
||||
|
||||
/// A completion for a field of a plugin's own run configuration (API 1.18).
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct RunConfigCompletion {
|
||||
pub label: String,
|
||||
pub detail: Option<String>,
|
||||
/// Replaces the UTF-16 range `[replace_start, replace_end)` of the field's text.
|
||||
pub insert: String,
|
||||
pub replace_start: u32,
|
||||
pub replace_end: u32,
|
||||
}
|
||||
@@ -3336,6 +3336,11 @@ pub(crate) mod run_anything_bindings {
|
||||
wasmtime::component::bindgen!({ world: "run-anything-exports", path: "../../wit" });
|
||||
}
|
||||
|
||||
/// The optional `run-configuration-completion` export (API 1.18), bound on its own when present.
|
||||
pub(crate) mod run_config_completion_bindings {
|
||||
wasmtime::component::bindgen!({ world: "run-configuration-completion-exports", path: "../../wit" });
|
||||
}
|
||||
|
||||
pub(crate) mod run_target_validation_bindings {
|
||||
wasmtime::component::bindgen!({ world: "run-target-validator", path: "../../wit" });
|
||||
}
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
99d690532f1d31fd1abfa9f827c488a03ec13a9a5b64d5805f9c3569f65a8f6f
|
||||
9857fa3a9b1d22d3b2c91a58fbf2c948267d87a6586ade7e0362fd6b6f4dd2ab
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
a892e79a21575fb0e755f1dc2a181403ec857789a80679489b113fcf8bf4f84b
|
||||
ba19f794de91eeac3a2509a9495b443ab7b0c90404156d8e4049e5eae777ab66
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
a0c3e4344024c7ec74a959670613f6f9e80b4a74a1c1b7801153e436a8db7b06
|
||||
0692fd551f6cc80338f8f655ad2384f37aef5c9498a0396532afa0e54a25f477
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
025151dc36746c6099113a7505cfb4a86420c0f0ff67fb16a4a798ab0ca0cacf
|
||||
6a25f9c9f9486468f1885cf81bccd90240014009ba3c507e478ce9b32468d594
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
eb6f32492301a263ab9a2949f7dfca1120c383536394601f26636926415c1825
|
||||
84bb08e094ec85d49abe713df02ac03a47dc7dbb6d8dfc754491083e0d0c46f5
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
bc5e4599cb4c9814e5b682c6c96b2a4814a478fc26e8324739de7b6f41dd4cac
|
||||
958ef1f5cd54a9b4c6fb99ee8e02793ca70a81698620da9ddf2b1b3f25b535c8
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
bccf0e0aea699c29a1f2ac9a28eddbca664678c78477f64a1a7e10793fe40009
|
||||
a846c18a1282242e25f0b61624c319fe10bdf322c224276a4a8edffd470ef940
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
3b5a8aeeeb7706a07dd5f5e36f3d1c291bd5add259411ae5ca62a0529ae45c76
|
||||
35f393de3ed681d206885612ae085b69dfef81ff8baa701a737c1914ac1412fb
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
728a5651af7082db08f70515a1d6211f95f00ec69671cc4f190a250d09da41ed
|
||||
e75dad45fb2a6bb8823b8edfb41b29403ec77f8e6e533bad42d0ae0cb1d68286
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
8e4897c52dbba37d3bc0d361aeae9e3ccc46e32ac099a0b967d145432303400f
|
||||
2cb47ff4fb3d401e95b742d78e026b872200dc503bf933ff9ce31d0557d69426
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
51282b7767d0e339b616f0cbc86ef72eac33a76605bd21793ecc021a62a25ff0
|
||||
e121d0fd2cc841ebb911904ada80921d01af392ccaa295b2fe0b2e7f4f51c58c
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
9729be3c12cd95d0b60c08b2179727f7290c38a984785bc7f9d8803109862efb
|
||||
c0ebc0e6b8601044ab88eba4929c8c73ab1278d3401b6594df35407f1a93cc24
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
b188b5f103fc01a9cc5db57ef235c94980be39268afb65d933fa6329253ceea8
|
||||
cea7369e69efee782e6a7b62736832e90890cd7af089884f3ed6e144542e0589
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
168933a0a65612f4710e8f86dd397a639640395283ad90b6c5066d2304343ea9
|
||||
f348c5ee1ce6d911ae53ea4aff185bdb6079729aee83561d3adb9d13eeb376fb
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
b41f219db5b29fb0ebbceeaf2c038b1f7c2c833adb71298ffd438282c4df1cd8
|
||||
5cd09b0da42f015faae666fbe210203b7ced9cf19d6ee542dadd236b7926b77b
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
58604dfb4be6b9c63466fac6ab065a2d961de105cfac623e75512a2852cd49bb
|
||||
ff2d1eac3fe4a2856e6310f36ed29d9a2ccffc8eeb41ded729dd01eadc244857
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
98b22bbd2bed239e4e2ea61403667f4e5eecdaeaa79180728b54da76267aa151
|
||||
e37a64052eef340a8482d8129badc50f29e8949316a33e6172a64e1a00f0718c
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
b98a3534c134661aca0fc442617ef000e44a57288c8ecde4afcdf4b2e0b0879e
|
||||
5f4dfb76c879bbbeb38f7c1b45c88818517743d742129a147e185bc7d2db7abc
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
830ee16ccf22bebe4a1d8c8f11ae83ef0d9b0f28cf55c1a6f5d5ceac0d63d531
|
||||
efe6d6c88d0bab2484f90cef6affe256c480297731ce585a5e3441e2648d9392
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
d338f3f6b191aef5975936b69d282ce7c5c342d0d8dd35ef79b60a7ea250c21f
|
||||
7b606308ee272adb1f659e7fd21069409b3bdbf12cd54b93232205bc8213f52a
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
b6b55ca65106d7c18d0f7bf56e8d392350fe130db44829a8886243978947c122
|
||||
6be054362a3c1f3545fdfba5c9b66d9eadcbeea3b160952068494c02bce3a4a1
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
85d8eccfe82fb067a018bd5eaabd3293405373e81e981a993386173c28d6bb13
|
||||
3cd84b9876d2e5a5294877ac14d69b18319be3208c192f67b6c3848039c48a79
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
e2de91a5ad6b5d94d7534b1f6066a0a24bcf5938dbf074323219ee7da407bf43
|
||||
e2c282bd0add6de51b6b275d16b950213fcdd24d1d882895b7d3099b0a7d569a
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
cee60971f3a115768fdf17498973cc6ded1acc891e2d0195aec15d99ef879f77
|
||||
84739ec73aa6b7b27d7a5062b78645d7342729806bc728f35a7b97c945c1a4fd
|
||||
@@ -1 +1 @@
|
||||
66cb8f9ed58ace06546c391d5b23aff96a9476011a6dc09ed002e6536e42cd5d
|
||||
ad43fa07182ff3d90154fdd788599d60db5fe0ab736dad03c6ae2cc2a1055eff
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
b0ebc1d11f3e159e8870b261014f81c3ee402a35bf8d4ccd70bf61daa9d60ea4
|
||||
639a93e98dd0fe3114ef7be3597ab559b69e4c54fdb5e96951cb19b894a020b9
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
c4963f0e4516b2c6cfbf1c0bc425d406028429a02a73f8a031ef987453a3efdf
|
||||
20aa26598608efac79c941531d4b5cd26b4e71a9b09e261560bc086410eb5c83
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
99d364abd638bb9953e37c2e3358b6b02813201d36db0e6f19361b8d585d3be8
|
||||
ca76bdb76b364ec445e06b893fdfb56cad1f05e4a1ff10affaa116b34c3160ec
|
||||
@@ -1,7 +1,7 @@
|
||||
id = "test.run-anything"
|
||||
name = "Run Anything fixture"
|
||||
version = "0.1.0"
|
||||
description = "Test fixture for [[contributes.runAnything]] and the run-anything-provider export (API 1.18)."
|
||||
description = "Test fixture for [[contributes.runAnything]], the run-anything-provider export and run configuration completion (API 1.18)."
|
||||
engines.openidea = "^1.18"
|
||||
wasm = "dist/plugin.wasm"
|
||||
|
||||
@@ -12,3 +12,12 @@ title = "Tasks"
|
||||
[[contributes.commands]]
|
||||
id = "ran"
|
||||
title = "Tasks Run So Far"
|
||||
|
||||
[capabilities]
|
||||
optional = ["process:task"]
|
||||
|
||||
[[contributes.runDetectors]]
|
||||
id = "tasks"
|
||||
name = "Task"
|
||||
files = ["Taskfile.yml"]
|
||||
command = "task"
|
||||
@@ -1,6 +1,10 @@
|
||||
//! API 1.18 fixture for `[[contributes.runAnything]]`: `task <name>` lines are
|
||||
//! suggested from a fixed task list and claimed when the task exists.
|
||||
use openidea_plugin::{Error, Invocation, Plugin, RunAnything, RunAnythingItem, register_plugin};
|
||||
//! suggested from a fixed task list and claimed when the task exists. The `tasks`
|
||||
//! run configuration completes task names in its Arguments field.
|
||||
use openidea_plugin::{
|
||||
Error, Invocation, Plugin, RunAnything, RunAnythingItem, RunConfigurationCompletion,
|
||||
RunConfigurationCompletionItem, register_plugin,
|
||||
};
|
||||
|
||||
const TASKS: [&str; 3] = ["build", "test", "docs:serve"];
|
||||
|
||||
@@ -43,4 +47,45 @@ impl RunAnything for Fixture {
|
||||
}
|
||||
}
|
||||
|
||||
register_plugin!(Fixture, run_anything);
|
||||
impl RunConfigurationCompletion for Fixture {
|
||||
/// Task names for the argument under the caret, replacing only that argument; nothing
|
||||
/// after `--` (the task's own arguments) or for another field or configuration.
|
||||
fn complete(
|
||||
&mut self,
|
||||
_project: &str,
|
||||
config: &str,
|
||||
field: &str,
|
||||
text: &str,
|
||||
caret: u32,
|
||||
) -> Vec<RunConfigurationCompletionItem> {
|
||||
if config != "tasks" || field != "arguments" {
|
||||
return Vec::new();
|
||||
}
|
||||
let units: Vec<u16> = text.encode_utf16().collect();
|
||||
let caret = (caret as usize).min(units.len());
|
||||
let is_space = |u: u16| u == b' ' as u16 || u == b'\t' as u16;
|
||||
let start = units[..caret].iter().rposition(|&u| is_space(u)).map_or(0, |i| i + 1);
|
||||
let end = units[caret..].iter().position(|&u| is_space(u)).map_or(units.len(), |i| caret + i);
|
||||
let before = String::from_utf16_lossy(&units[..start]);
|
||||
if before.split_whitespace().any(|w| w == "--") {
|
||||
return Vec::new();
|
||||
}
|
||||
let typed = String::from_utf16_lossy(&units[start..caret]);
|
||||
if typed.starts_with('-') {
|
||||
return Vec::new();
|
||||
}
|
||||
TASKS
|
||||
.iter()
|
||||
.filter(|t| t.starts_with(typed.as_str()))
|
||||
.map(|t| RunConfigurationCompletionItem {
|
||||
label: (*t).into(),
|
||||
detail: Some("Taskfile.yml".into()),
|
||||
insert: None,
|
||||
replace_start: start as u32,
|
||||
replace_end: end as u32,
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
register_plugin!(Fixture, run_anything, run_configuration_completion);
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
e00c8836362098a6a84cf24a3a2949c849894289ba52405fae85eccaeced4bb8
|
||||
7307879ddca36b6a944bb3b5d3011916a3074e50d7f187aa258394c8c5123d91
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
e6098c22fa5cc77cc07f342e0416e3cdc5340e464d7006d791e783bc41855ffe
|
||||
82a408bddf01af0e7a34a585a60d165e12ad5982e7843d6091a2f4e6fac15c55
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
f65a0616a010b78e18e6eda8b329b2711136f0943d051cc36028ce1c5356560d
|
||||
04b1807c79763f6e2f74503d545007dbdb478f7aae010dd8330e768c1dc3a9ad
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
7abe942edc15ff9d3e9f26c3e1b5bb7789d1546b15611a846e4043be2cff065a
|
||||
53e4f47e38a8622e2ef0d03e4ed2369fb906e941d9e9734ed9d57fe5cbc5ead3
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
81f6ef485fb7550ca75df1143254516ee9bfec4d3602d03c20a9a4ae4819f9df
|
||||
d6bd0b261c6db62d04197c28b251a03acc5f32cb21c5133ac3aaeb3e37fe5eab
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
b1fa889c36b58981a5089f4891cfe6df05321ddd59bf25c3022120a7a502ddf5
|
||||
a7728793d40c78dc5ebfd74c013425358c888da87a2cce15a5e8c306ab5b6b30
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
e396ef5d0ba37f0ae46b59b07636b9972417f77cf27fc7b47d35a70ab0cad03f
|
||||
1fca4a563944897ea1e55c49533c157f005e5efbc1aeabac65037cad1f05c2ba
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
2bfb86ad46638bcf98e40470b012a892e0e155d73773403b3f8e2a2ec39a7428
|
||||
2be637ed5d3c72adf1a8b92aaea86602ab81ffaeeff99a719f6f67c244b82137
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
c875e5ed8d6d2f0fce73211c3c340501ff1908be100438ddb1a5e3702928d326
|
||||
3a1aad965fa557b13e2aab2b714c68845d1890a6e98ab9155ccfc952ab2c64d5
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
a16c71f3fc05ac2d2bfc6fb91e5b85c4ae5fbb07fbf6eec40d4d6307394ae78c
|
||||
0ad7071e1674170ae360d873fda38656dbba6740514c7bfca642e7881cbd9c18
|
||||
@@ -58,34 +58,35 @@ The plugin calls these. Most are gated by a [capability](/en/plugins/capabilitie
|
||||
|
||||
The IDE calls these. The first three are in every code plugin; the rest are optional and each comes with its own world.
|
||||
|
||||
| Interface | File | Summary |
|
||||
| -------------------------- | ------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
|
||||
| `lifecycle` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | `activate` and `deactivate` of an instance |
|
||||
| `commands` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | Runs one of the plugin's declared commands |
|
||||
| `event-handler` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | Receives batches of subscribed events |
|
||||
| `syntax-provider` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | Highlighting, outline and folding for plugin languages without a grammar |
|
||||
| `run-target-validation` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | Checks a launch through one of the plugin's run targets before it starts (API 1.5) |
|
||||
| `providers` | [providers.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/providers.wit) | Completion, inline completion, code actions, navigation and line markers for declared languages |
|
||||
| `language-features` | [language-features.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/language-features.wit) | Formatting, signature help, highlights, links, code lenses, folds, colours, symbols, gutter actions and more (API 1.4) |
|
||||
| `completion-list-provider` | [completion-list.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/completion-list.wit) | Completion whose list can be marked incomplete, asked again while typing on (API 1.16) |
|
||||
| `injections` | [injections.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/injections.wit) | Ranges of embedded languages inside a document (API 1.4) |
|
||||
| `hover-provider` | [hover.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/hover.wit) | Markdown added to the hover of any language |
|
||||
| `hover-actions` | [hover-actions.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/hover-actions.wit) | Hover-revealed line actions at the left edge of a line (API 1.14): anchor line and inclusive trigger line range |
|
||||
| `inlay-hints-provider` | [inlay.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/inlay.wit) | Inline hints in any language |
|
||||
| `semantic-tokens-provider` | [semantic.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/semantic.wit) | Semantic colouring in any language |
|
||||
| `diagnostics-provider` | [diagnostics.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/diagnostics.wit) | Problems in the current, possibly unsaved document |
|
||||
| `file-actions` | [file-actions.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/file-actions.wit) | Quick fixes and refactorings that create, rename or delete files |
|
||||
| `document-indexer` | [indexing.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/indexing.wit) | Cross-file definitions, references and gutter markers, indexed in the background |
|
||||
| `endpoints-provider` | [endpoints.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/endpoints.wit) | A project's HTTP endpoints for Search Everywhere and the HTTP client |
|
||||
| `search-provider` | [search.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/search.wit) | Cancellable queries for a plugin-defined Search Everywhere tab (API 1.14) |
|
||||
| `view-provider` | [views.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/views.wit) | Content and events of declared views and custom editors |
|
||||
| `detail-provider` | [details.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/details.wit) | The detail pane of the plugin's nodes in the Services tool window |
|
||||
| `commit-checker` | [commit.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/commit.wit) | Before-commit checks |
|
||||
| `run-configurations` | [run.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/run.wit) | Dynamic run configurations for a project (API 1.4) |
|
||||
| `launch-configurations` | [run.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/run.wit) | Run configurations with an environment and a debugger (API 1.9) |
|
||||
| `execution-configurations` | [run.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/run.wit) | Run configurations with environment, debugger, and default output mode (API 1.18) |
|
||||
| `test-results` | [run.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/run.wit) | Parsing test output and selecting tests to rerun (API 1.4) |
|
||||
| `mcp-provider` | [mcp.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/mcp.wit) | Tools the plugin contributes to the built-in MCP server (API 1.4) |
|
||||
| Interface | File | Summary |
|
||||
| ------------------------------ | ------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
|
||||
| `lifecycle` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | `activate` and `deactivate` of an instance |
|
||||
| `commands` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | Runs one of the plugin's declared commands |
|
||||
| `event-handler` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | Receives batches of subscribed events |
|
||||
| `syntax-provider` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | Highlighting, outline and folding for plugin languages without a grammar |
|
||||
| `run-target-validation` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | Checks a launch through one of the plugin's run targets before it starts (API 1.5) |
|
||||
| `providers` | [providers.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/providers.wit) | Completion, inline completion, code actions, navigation and line markers for declared languages |
|
||||
| `language-features` | [language-features.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/language-features.wit) | Formatting, signature help, highlights, links, code lenses, folds, colours, symbols, gutter actions and more (API 1.4) |
|
||||
| `completion-list-provider` | [completion-list.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/completion-list.wit) | Completion whose list can be marked incomplete, asked again while typing on (API 1.16) |
|
||||
| `injections` | [injections.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/injections.wit) | Ranges of embedded languages inside a document (API 1.4) |
|
||||
| `hover-provider` | [hover.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/hover.wit) | Markdown added to the hover of any language |
|
||||
| `hover-actions` | [hover-actions.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/hover-actions.wit) | Hover-revealed line actions at the left edge of a line (API 1.14): anchor line and inclusive trigger line range |
|
||||
| `inlay-hints-provider` | [inlay.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/inlay.wit) | Inline hints in any language |
|
||||
| `semantic-tokens-provider` | [semantic.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/semantic.wit) | Semantic colouring in any language |
|
||||
| `diagnostics-provider` | [diagnostics.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/diagnostics.wit) | Problems in the current, possibly unsaved document |
|
||||
| `file-actions` | [file-actions.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/file-actions.wit) | Quick fixes and refactorings that create, rename or delete files |
|
||||
| `document-indexer` | [indexing.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/indexing.wit) | Cross-file definitions, references and gutter markers, indexed in the background |
|
||||
| `endpoints-provider` | [endpoints.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/endpoints.wit) | A project's HTTP endpoints for Search Everywhere and the HTTP client |
|
||||
| `search-provider` | [search.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/search.wit) | Cancellable queries for a plugin-defined Search Everywhere tab (API 1.14) |
|
||||
| `view-provider` | [views.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/views.wit) | Content and events of declared views and custom editors |
|
||||
| `detail-provider` | [details.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/details.wit) | The detail pane of the plugin's nodes in the Services tool window |
|
||||
| `commit-checker` | [commit.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/commit.wit) | Before-commit checks |
|
||||
| `run-configurations` | [run.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/run.wit) | Dynamic run configurations for a project (API 1.4) |
|
||||
| `launch-configurations` | [run.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/run.wit) | Run configurations with an environment and a debugger (API 1.9) |
|
||||
| `execution-configurations` | [run.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/run.wit) | Run configurations with environment, debugger, and default output mode (API 1.18) |
|
||||
| `run-configuration-completion` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | Completion in the Arguments field of the plugin's own run configurations (API 1.18) |
|
||||
| `test-results` | [run.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/run.wit) | Parsing test output and selecting tests to rerun (API 1.4) |
|
||||
| `mcp-provider` | [mcp.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/mcp.wit) | Tools the plugin contributes to the built-in MCP server (API 1.4) |
|
||||
|
||||
## Other languages
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ every start. On top of that, a plugin can:
|
||||
| Compute the project's configurations in code | `[[contributes.runConfigurations]]` + `run-configurations` export | 1.4 |
|
||||
| Give configurations an environment and a debugger | `launch-configurations` export | 1.9 |
|
||||
| Set a default PTY or piped output mode on configurations | `execution-configurations` export / `runDetectors.outputMode` | 1.18 |
|
||||
| Complete the Arguments field of its configurations | `run-configuration-completion` export | 1.18 |
|
||||
| Turn test output into the IDE's test tree | `test-results` export, `framework = "plugin"` | 1.4 |
|
||||
| Start one of its configurations from a command | `host::start_run` / `host::start_run_with_options` (`run` WIT) | 1.4 / 1.18 |
|
||||
| Make every run of the project go through a wrapper (DDEV, a container) | `host::register_run_target` (WIT `run-targets`) | 1.4 |
|
||||
@@ -205,10 +206,20 @@ per-invocation `output_mode`, which wins over the plugin's configured default. D
|
||||
combinations (`test` configurations, `debug` launches requesting `Pty`, remote run targets,
|
||||
and `stdin` file redirection) are rejected with `Invalid`.
|
||||
|
||||
## Completing arguments
|
||||
|
||||
Export `run-configuration-completion` (`RunConfigurationCompletion`, registered as
|
||||
`run_configuration_completion`) to complete the Arguments field of your configurations in
|
||||
**Run | Edit Configurations…**, such as task names for a task runner. The IDE passes the
|
||||
configuration's id, `field = "arguments"`, the text and a UTF-16 caret offset while the user
|
||||
types (or presses Ctrl+Space). Each item replaces the UTF-16 range it names, so the other
|
||||
options, quoted values and arguments after `--` stay as typed. Answer from what the plugin
|
||||
already knows: the IDE keeps 200 items and drops answers slower than 300 ms or for text that
|
||||
has changed since.
|
||||
|
||||
<Note>
|
||||
Ordinary pseudo-terminals (PTYs) combine `stdout` and `stderr` into a single output stream
|
||||
and can change buffering, input handling, and terminal behavior (line endings, echo, and
|
||||
ANSI control sequences).
|
||||
Ordinary pseudo-terminals (PTYs) combine `stdout` and `stderr` into a single output stream and can change buffering,
|
||||
input handling, and terminal behavior (line endings, echo, and ANSI control sequences).
|
||||
</Note>
|
||||
|
||||
## Run targets
|
||||
|
||||
@@ -12,27 +12,27 @@ The plugin API has one version number: the version of the WIT package in [`wit/`
|
||||
|
||||
## Versions
|
||||
|
||||
| API | Shipped with | Highlights |
|
||||
| ------ | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| 1.0.0 | OpenIDEA 0.1.36 | The base API: commands, events, storage, tasks, project and editor access, VCS, diagnostics, network and secrets, processes, declarative views and custom editors, settings, editor providers, syntax provider |
|
||||
| 1.1.0 | OpenIDEA 0.1.37 | `vcs.remotes`, `ui.copy-to-clipboard`, `ui.open-url`, opening a project file at a line from a view |
|
||||
| 1.2.0 | OpenIDEA 0.1.38 | Background document indexers, pickers, input boxes and confirmations, plugin context keys for `when` clauses, the files selected in the Project view, a manifest `icon`, the `viewItem.context` menu |
|
||||
| 1.3.0 | OpenIDEA 0.1.39 | Commit message and before-commit checks, Services detail panes, diagnostics while typing, hover, inlay hints, semantic tokens, file-changing code actions, HTTP endpoints, files outside the project (`fs.read`/`fs.write`, `project.write`, private plugin directory), batched `files-changed` events and path filters, workspace symbols, long-running processes, notifications with buttons, translations, multi-page settings, file template variables, web view PTYs, log tabs and content tabs |
|
||||
| 1.4.0 | OpenIDEA 0.1.40 | `net.http:`, `ipc:`, `ide.commands` and `database.sources` capabilities; editor and project snapshots, decorations, text search, Problems, Git log/blame/diff; output channels; OAuth loopback; runs, terminal sessions, run configurations, test result parsing and run targets; formatting and other language features; embedded languages; snippets; more menu locations; database sources; MCP tools |
|
||||
| 1.5.0 | OpenIDEA 0.1.41 | `Project::notify` (a notification in one project's window), the `net:ask` capability, run target validation, per-command run target working-directory arguments |
|
||||
| 1.6.0 | OpenIDEA 0.1.43 | Bounded, project-bound background WebSockets for event-stream plugins |
|
||||
| 1.7.0 | OpenIDEA 0.1.44 | `views.open-diff`: two texts in the diff viewer, such as a review's file before and after |
|
||||
| 1.8.0 | OpenIDEA 0.1.45 | The `problems-changed` workbench event: the host keeps every producer's diagnostics per file, so an annotation follows the file rather than the invoking window |
|
||||
| 1.9.0 | OpenIDEA 0.1.46 | Run configurations with an environment and a debugger, requests to a running language server (`lsp:<server>`), server commands routed to plugins, editor panels |
|
||||
| 1.10.0 | OpenIDEA 0.1.47 | `build.dependencies`: the Maven / Gradle dependency graph the IDE resolved (`build.read`) |
|
||||
| 1.11.0 | In development on `main` | `ui.read-clipboard`: the clipboard's text and image in commands the user ran (`clipboard.read`) |
|
||||
| 1.12.0 | In development on `main` | `ui.set-console-rules`: highlight rules (regex, palette colours, styles) for Run and Debug console output |
|
||||
| 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 | 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 | OpenIDEA 0.1.53 | `decorations.set-styled`: editor decorations with their own `#rrggbb` / `#rrggbbaa` foreground and background, for colors outside the theme palette |
|
||||
| 1.18.0 | In development on `main` | `[[contributes.overlays]]`: a package web page floating over the workbench that never takes the keyboard focus, placed and resized through `openidea.overlay`; `[[contributes.dialogs]]`: a package web page in a modal, resizable IDE dialog opened with `views.reveal`, with a `closed` view event and `openidea.dialog.close()`; `events.subscribe-paths-with-options` (`debounce-ms`), `workspace.project.generation` and `FilesChanged` project/generation fields, stale run target/configuration rejection, and the `project-closed` lifecycle event; `execution-configurations`, `run.start-with-options` and `runDetectors.outputMode`: `pipes` or `pty` console output for plugin run configurations; `[[contributes.runAnything]]` with the `run-anything-provider` export: Run Anything lines starting with the plugin's prefix; `views.open-terminal-session-in`: a keyed terminal in a project directory; `workspace.invoking-project`: the project of the window a call serves, also in `gutter-actions` and `hover-actions`; `events.watch-paths` and the `watched-files-changed` event: files and directories outside the project, within `fs.read` grants |
|
||||
| API | Shipped with | Highlights |
|
||||
| ------ | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| 1.0.0 | OpenIDEA 0.1.36 | The base API: commands, events, storage, tasks, project and editor access, VCS, diagnostics, network and secrets, processes, declarative views and custom editors, settings, editor providers, syntax provider |
|
||||
| 1.1.0 | OpenIDEA 0.1.37 | `vcs.remotes`, `ui.copy-to-clipboard`, `ui.open-url`, opening a project file at a line from a view |
|
||||
| 1.2.0 | OpenIDEA 0.1.38 | Background document indexers, pickers, input boxes and confirmations, plugin context keys for `when` clauses, the files selected in the Project view, a manifest `icon`, the `viewItem.context` menu |
|
||||
| 1.3.0 | OpenIDEA 0.1.39 | Commit message and before-commit checks, Services detail panes, diagnostics while typing, hover, inlay hints, semantic tokens, file-changing code actions, HTTP endpoints, files outside the project (`fs.read`/`fs.write`, `project.write`, private plugin directory), batched `files-changed` events and path filters, workspace symbols, long-running processes, notifications with buttons, translations, multi-page settings, file template variables, web view PTYs, log tabs and content tabs |
|
||||
| 1.4.0 | OpenIDEA 0.1.40 | `net.http:`, `ipc:`, `ide.commands` and `database.sources` capabilities; editor and project snapshots, decorations, text search, Problems, Git log/blame/diff; output channels; OAuth loopback; runs, terminal sessions, run configurations, test result parsing and run targets; formatting and other language features; embedded languages; snippets; more menu locations; database sources; MCP tools |
|
||||
| 1.5.0 | OpenIDEA 0.1.41 | `Project::notify` (a notification in one project's window), the `net:ask` capability, run target validation, per-command run target working-directory arguments |
|
||||
| 1.6.0 | OpenIDEA 0.1.43 | Bounded, project-bound background WebSockets for event-stream plugins |
|
||||
| 1.7.0 | OpenIDEA 0.1.44 | `views.open-diff`: two texts in the diff viewer, such as a review's file before and after |
|
||||
| 1.8.0 | OpenIDEA 0.1.45 | The `problems-changed` workbench event: the host keeps every producer's diagnostics per file, so an annotation follows the file rather than the invoking window |
|
||||
| 1.9.0 | OpenIDEA 0.1.46 | Run configurations with an environment and a debugger, requests to a running language server (`lsp:<server>`), server commands routed to plugins, editor panels |
|
||||
| 1.10.0 | OpenIDEA 0.1.47 | `build.dependencies`: the Maven / Gradle dependency graph the IDE resolved (`build.read`) |
|
||||
| 1.11.0 | In development on `main` | `ui.read-clipboard`: the clipboard's text and image in commands the user ran (`clipboard.read`) |
|
||||
| 1.12.0 | In development on `main` | `ui.set-console-rules`: highlight rules (regex, palette colours, styles) for Run and Debug console output |
|
||||
| 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 | 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 | OpenIDEA 0.1.53 | `decorations.set-styled`: editor decorations with their own `#rrggbb` / `#rrggbbaa` foreground and background, for colors outside the theme palette |
|
||||
| 1.18.0 | In development on `main` | `[[contributes.overlays]]`: a package web page floating over the workbench that never takes the keyboard focus, placed and resized through `openidea.overlay`; `[[contributes.dialogs]]`: a package web page in a modal, resizable IDE dialog opened with `views.reveal`, with a `closed` view event and `openidea.dialog.close()`; `events.subscribe-paths-with-options` (`debounce-ms`), `workspace.project.generation` and `FilesChanged` project/generation fields, stale run target/configuration rejection, and the `project-closed` lifecycle event; `execution-configurations`, `run.start-with-options` and `runDetectors.outputMode`: `pipes` or `pty` console output for plugin run configurations; `[[contributes.runAnything]]` with the `run-anything-provider` export: Run Anything lines starting with the plugin's prefix; `views.open-terminal-session-in`: a keyed terminal in a project directory; `workspace.invoking-project`: the project of the window a call serves, also in `gutter-actions` and `hover-actions`; `events.watch-paths` and the `watched-files-changed` event: files and directories outside the project, within `fs.read` grants; the `run-configuration-completion` export: completion in the Arguments field of the plugin's own run configurations |
|
||||
|
||||
The full list of what each version added is in [`plugins/README.md`](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md).
|
||||
|
||||
|
||||
@@ -58,34 +58,35 @@ description: "openidea:plugin WIT 包中的每个 interface:一句话说明及
|
||||
|
||||
由 IDE 调用。前三个是每个代码插件都有的;其余都是可选的,各自对应一个 world。
|
||||
|
||||
| Interface | 文件 | 说明 |
|
||||
| -------------------------- | ------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------- |
|
||||
| `lifecycle` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | 实例的 `activate` 和 `deactivate` |
|
||||
| `commands` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | 执行插件声明的某个命令 |
|
||||
| `event-handler` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | 接收订阅事件的批次 |
|
||||
| `syntax-provider` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | 为没有语法定义的插件语言提供高亮、大纲和折叠 |
|
||||
| `run-target-validation` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | 通过插件的运行目标启动前进行检查(API 1.5) |
|
||||
| `providers` | [providers.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/providers.wit) | 为声明的语言提供补全、行内补全、代码操作、导航和行标记 |
|
||||
| `language-features` | [language-features.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/language-features.wit) | 格式化、签名帮助、高亮、链接、代码透镜、折叠、颜色、符号、装订区操作等(API 1.4) |
|
||||
| `completion-list-provider` | [completion-list.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/completion-list.wit) | 可标记为不完整的补全列表,继续输入时再次询问(API 1.16) |
|
||||
| `injections` | [injections.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/injections.wit) | 文档中嵌入语言的范围(API 1.4) |
|
||||
| `hover-provider` | [hover.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/hover.wit) | 向任意语言的悬停追加 Markdown |
|
||||
| `hover-actions` | [hover-actions.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/hover-actions.wit) | 行左侧边缘的 hover 操作(API 1.14):锚定行和包含式触发行范围 |
|
||||
| `inlay-hints-provider` | [inlay.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/inlay.wit) | 任意语言中的内嵌提示 |
|
||||
| `semantic-tokens-provider` | [semantic.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/semantic.wit) | 任意语言中的语义着色 |
|
||||
| `diagnostics-provider` | [diagnostics.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/diagnostics.wit) | 当前文档(可能未保存)中的问题 |
|
||||
| `file-actions` | [file-actions.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/file-actions.wit) | 创建、重命名或删除文件的快速修复和重构 |
|
||||
| `document-indexer` | [indexing.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/indexing.wit) | 在后台索引的跨文件定义、引用和装订区标记 |
|
||||
| `endpoints-provider` | [endpoints.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/endpoints.wit) | 项目的 HTTP 端点,供 随处搜索 和 HTTP 客户端使用 |
|
||||
| `search-provider` | [search.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/search.wit) | 插件自定义全局搜索分类的可取消查询(API 1.14) |
|
||||
| `view-provider` | [views.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/views.wit) | 声明的视图和自定义编辑器的内容与事件 |
|
||||
| `detail-provider` | [details.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/details.wit) | Services 工具窗口中插件节点的详情面板 |
|
||||
| `commit-checker` | [commit.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/commit.wit) | 提交前检查 |
|
||||
| `run-configurations` | [run.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/run.wit) | 项目的动态运行配置(API 1.4) |
|
||||
| `launch-configurations` | [run.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/run.wit) | 带环境变量和调试器的运行配置(API 1.9) |
|
||||
| `execution-configurations` | [run.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/run.wit) | 带环境变量、调试器和默认输出模式的运行配置(API 1.18) |
|
||||
| `test-results` | [run.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/run.wit) | 解析测试输出、选择要重新运行的测试(API 1.4) |
|
||||
| `mcp-provider` | [mcp.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/mcp.wit) | 插件为内置 MCP 服务器提供的工具(API 1.4) |
|
||||
| Interface | 文件 | 说明 |
|
||||
| ------------------------------ | ------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------- |
|
||||
| `lifecycle` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | 实例的 `activate` 和 `deactivate` |
|
||||
| `commands` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | 执行插件声明的某个命令 |
|
||||
| `event-handler` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | 接收订阅事件的批次 |
|
||||
| `syntax-provider` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | 为没有语法定义的插件语言提供高亮、大纲和折叠 |
|
||||
| `run-target-validation` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | 通过插件的运行目标启动前进行检查(API 1.5) |
|
||||
| `providers` | [providers.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/providers.wit) | 为声明的语言提供补全、行内补全、代码操作、导航和行标记 |
|
||||
| `language-features` | [language-features.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/language-features.wit) | 格式化、签名帮助、高亮、链接、代码透镜、折叠、颜色、符号、装订区操作等(API 1.4) |
|
||||
| `completion-list-provider` | [completion-list.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/completion-list.wit) | 可标记为不完整的补全列表,继续输入时再次询问(API 1.16) |
|
||||
| `injections` | [injections.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/injections.wit) | 文档中嵌入语言的范围(API 1.4) |
|
||||
| `hover-provider` | [hover.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/hover.wit) | 向任意语言的悬停追加 Markdown |
|
||||
| `hover-actions` | [hover-actions.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/hover-actions.wit) | 行左侧边缘的 hover 操作(API 1.14):锚定行和包含式触发行范围 |
|
||||
| `inlay-hints-provider` | [inlay.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/inlay.wit) | 任意语言中的内嵌提示 |
|
||||
| `semantic-tokens-provider` | [semantic.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/semantic.wit) | 任意语言中的语义着色 |
|
||||
| `diagnostics-provider` | [diagnostics.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/diagnostics.wit) | 当前文档(可能未保存)中的问题 |
|
||||
| `file-actions` | [file-actions.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/file-actions.wit) | 创建、重命名或删除文件的快速修复和重构 |
|
||||
| `document-indexer` | [indexing.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/indexing.wit) | 在后台索引的跨文件定义、引用和装订区标记 |
|
||||
| `endpoints-provider` | [endpoints.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/endpoints.wit) | 项目的 HTTP 端点,供 随处搜索 和 HTTP 客户端使用 |
|
||||
| `search-provider` | [search.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/search.wit) | 插件自定义全局搜索分类的可取消查询(API 1.14) |
|
||||
| `view-provider` | [views.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/views.wit) | 声明的视图和自定义编辑器的内容与事件 |
|
||||
| `detail-provider` | [details.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/details.wit) | Services 工具窗口中插件节点的详情面板 |
|
||||
| `commit-checker` | [commit.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/commit.wit) | 提交前检查 |
|
||||
| `run-configurations` | [run.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/run.wit) | 项目的动态运行配置(API 1.4) |
|
||||
| `launch-configurations` | [run.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/run.wit) | 带环境变量和调试器的运行配置(API 1.9) |
|
||||
| `execution-configurations` | [run.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/run.wit) | 带环境变量、调试器和默认输出模式的运行配置(API 1.18) |
|
||||
| `run-configuration-completion` | [exports.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/exports.wit) | 补全插件自己运行配置的“实参”字段(API 1.18) |
|
||||
| `test-results` | [run.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/run.wit) | 解析测试输出、选择要重新运行的测试(API 1.4) |
|
||||
| `mcp-provider` | [mcp.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/mcp.wit) | 插件为内置 MCP 服务器提供的工具(API 1.4) |
|
||||
|
||||
## 其他语言
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ description: "贡献运行配置,把测试输出解析进测试树,从代码
|
||||
| 在代码中计算项目的运行配置 | `[[contributes.runConfigurations]]` + `run-configurations` 导出 | 1.4 |
|
||||
| 给配置加上环境变量和调试器 | `launch-configurations` 导出 | 1.9 |
|
||||
| 为配置设置默认的 PTY 或管道输出模式 | `execution-configurations` 导出 / `runDetectors.outputMode` | 1.18 |
|
||||
| 补全自己配置的“实参”字段 | `run-configuration-completion` 导出 | 1.18 |
|
||||
| 把测试输出转成 IDE 的测试树 | `test-results` 导出,`framework = "plugin"` | 1.4 |
|
||||
| 从命令中启动自己的某个配置 | `host::start_run` / `host::start_run_with_options`(`run` WIT) | 1.4 / 1.18 |
|
||||
| 让项目的所有运行都经过包装程序(DDEV、容器等) | `host::register_run_target`(WIT `run-targets`) | 1.4 |
|
||||
@@ -180,6 +181,14 @@ fn run_command(&mut self, _id: &str, _ctx: &Invocation, arg: Option<&str>) -> Re
|
||||
|
||||
> 普通伪终端(PTY)会将 `stdout` 和 `stderr` 合并为同一输出流,并可能改变缓冲、输入处理及终端行为(换行、回显与 ANSI 控制序列)。
|
||||
|
||||
## 补全实参
|
||||
|
||||
导出 `run-configuration-completion`(实现 `RunConfigurationCompletion`,注册为 `run_configuration_completion`),
|
||||
就能在 **运行 | 编辑配置…** 中补全自己配置的“实参”字段,比如任务运行器的任务名。用户输入(或按 Ctrl+Space)时,
|
||||
IDE 传入配置 id、`field = "arguments"`、字段文本和以 UTF-16 计的光标位置。每一项只替换它给出的 UTF-16 区间,
|
||||
其他选项、带引号的值和 `--` 之后的参数保持原样。请根据插件已经掌握的信息作答:IDE 最多保留 200 项,
|
||||
超过 300 ms 或文本已经变化后的回答会被丢弃。
|
||||
|
||||
## 运行目标
|
||||
|
||||
运行目标是项目级的包装程序:选用它的每一次运行、测试、脚本和解释器启动,都会被改写为通过插件所有的程序执行,
|
||||
|
||||
@@ -9,27 +9,27 @@ description: "engines.openidea、插件 API 从 1.0 到 1.13 的各个版本,
|
||||
|
||||
## 版本历史
|
||||
|
||||
| API | 随哪个版本发布 | 主要内容 |
|
||||
| ------ | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| 1.0.0 | OpenIDEA 0.1.36 | 基础 API:命令、事件、存储、任务、项目和编辑器访问、VCS、诊断、网络与密钥、进程、声明式视图和自定义编辑器、设置、编辑器 provider、syntax provider |
|
||||
| 1.1.0 | OpenIDEA 0.1.37 | `vcs.remotes`、`ui.copy-to-clipboard`、`ui.open-url`,从视图中打开项目文件的指定行 |
|
||||
| 1.2.0 | OpenIDEA 0.1.38 | 后台文档索引器;选择器、输入框和确认框;插件自定义的 `when` 上下文键;项目视图中选中的文件;清单 `icon`;`viewItem.context` 菜单 |
|
||||
| 1.3.0 | OpenIDEA 0.1.39 | 提交信息和提交前检查、Services 详情面板、输入时诊断、悬停、内嵌提示、语义 token、改动文件的代码操作、HTTP 端点、项目外文件(`fs.read`/`fs.write`、`project.write`、插件私有目录)、批量 `files-changed` 事件和路径过滤、工作区符号、长时间运行的进程、带按钮的通知、翻译、多页设置、文件模板变量、Web 视图 PTY、日志标签页和内容标签页 |
|
||||
| 1.4.0 | OpenIDEA 0.1.40 | `net.http:`、`ipc:`、`ide.commands` 和 `database.sources` 能力;编辑器与项目快照、装饰、文本搜索、问题视图、Git log/blame/diff;输出通道;OAuth 回环;运行、终端会话、运行配置、测试结果解析和运行目标;格式化等语言功能;嵌入语言;代码片段;更多菜单位置;数据库数据源;MCP 工具 |
|
||||
| 1.5.0 | OpenIDEA 0.1.41 | `Project::notify`(只在某个项目的窗口中显示通知)、`net:ask` 能力、运行目标启动前校验、运行目标按命令设置工作目录参数 |
|
||||
| 1.6.0 | OpenIDEA 0.1.43 | 面向事件流插件、受容量限制且绑定项目的后台 WebSocket |
|
||||
| 1.7.0 | OpenIDEA 0.1.44 | `views.open-diff`:在差异查看器中对比两段文本,例如评审中某个文件的修改前后 |
|
||||
| 1.8.0 | OpenIDEA 0.1.45 | `problems-changed` 工作台事件:宿主按文件保存每个生产者的诊断,注解跟着文件走,而不是跟着调用它的窗口 |
|
||||
| 1.9.0 | OpenIDEA 0.1.46 | 带环境变量和调试器的运行配置、向正在运行的语言服务器发送请求(`lsp:<server>`)、交给插件处理的服务器命令、编辑器面板 |
|
||||
| 1.10.0 | OpenIDEA 0.1.47 | `build.dependencies`:IDE 已解析的 Maven / Gradle 依赖图(`build.read`) |
|
||||
| 1.11.0 | `main` 上开发中 | `ui.read-clipboard`:在用户运行的命令中读取剪贴板的文本和图片(`clipboard.read`) |
|
||||
| 1.12.0 | `main` 上开发中 | `ui.set-console-rules`:Run/Debug 控制台输出的高亮规则(正则、调色板颜色、文本样式) |
|
||||
| 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 | OpenIDEA 0.1.52 | 可选 `completion-list-provider` 导出:标记为不完整的补全在继续输入时再次询问,不会重新询问语言服务器和其他插件;`decorations.set-markdown`:悬停显示 Markdown 卡片的行尾装饰 |
|
||||
| 1.17.0 | OpenIDEA 0.1.53 | `decorations.set-styled`:自带 `#rrggbb` / `#rrggbbaa` 前景色和背景色的编辑器装饰,用于主题调色板之外的颜色 |
|
||||
| 1.18.0 | `main` 上开发中 | `[[contributes.overlays]]`:悬浮在工作台上方、从不抢占键盘焦点的插件网页,可通过 `openidea.overlay` 移动和调整大小;`[[contributes.dialogs]]`:插件网页显示在可调整大小的模态对话框中,用 `views.reveal` 打开,关闭时发 `closed` 视图事件,页面可调用 `openidea.dialog.close()`;`events.subscribe-paths-with-options`(`debounce-ms`)、`workspace.project.generation` 与 `FilesChanged` 的 `project`/`generation` 字段、过期运行目标/配置拒绝以及 `project-closed` 生命周期事件;`execution-configurations`、`run.start-with-options` 与 `runDetectors.outputMode`:插件运行配置的控制台输出方式(`pipes` 或 `pty`);`[[contributes.runAnything]]` 与 `run-anything-provider` 导出:以插件前缀开头的 Run Anything 行;`views.open-terminal-session-in`:在项目子目录中打开带 key 的终端;`workspace.invoking-project`:本次调用所服务窗口的项目,`gutter-actions` 和 `hover-actions` 中也可用;`events.watch-paths` 与 `watched-files-changed` 事件:监听项目之外、`fs.read` 授权范围内的文件和目录 |
|
||||
| API | 随哪个版本发布 | 主要内容 |
|
||||
| ------ | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| 1.0.0 | OpenIDEA 0.1.36 | 基础 API:命令、事件、存储、任务、项目和编辑器访问、VCS、诊断、网络与密钥、进程、声明式视图和自定义编辑器、设置、编辑器 provider、syntax provider |
|
||||
| 1.1.0 | OpenIDEA 0.1.37 | `vcs.remotes`、`ui.copy-to-clipboard`、`ui.open-url`,从视图中打开项目文件的指定行 |
|
||||
| 1.2.0 | OpenIDEA 0.1.38 | 后台文档索引器;选择器、输入框和确认框;插件自定义的 `when` 上下文键;项目视图中选中的文件;清单 `icon`;`viewItem.context` 菜单 |
|
||||
| 1.3.0 | OpenIDEA 0.1.39 | 提交信息和提交前检查、Services 详情面板、输入时诊断、悬停、内嵌提示、语义 token、改动文件的代码操作、HTTP 端点、项目外文件(`fs.read`/`fs.write`、`project.write`、插件私有目录)、批量 `files-changed` 事件和路径过滤、工作区符号、长时间运行的进程、带按钮的通知、翻译、多页设置、文件模板变量、Web 视图 PTY、日志标签页和内容标签页 |
|
||||
| 1.4.0 | OpenIDEA 0.1.40 | `net.http:`、`ipc:`、`ide.commands` 和 `database.sources` 能力;编辑器与项目快照、装饰、文本搜索、问题视图、Git log/blame/diff;输出通道;OAuth 回环;运行、终端会话、运行配置、测试结果解析和运行目标;格式化等语言功能;嵌入语言;代码片段;更多菜单位置;数据库数据源;MCP 工具 |
|
||||
| 1.5.0 | OpenIDEA 0.1.41 | `Project::notify`(只在某个项目的窗口中显示通知)、`net:ask` 能力、运行目标启动前校验、运行目标按命令设置工作目录参数 |
|
||||
| 1.6.0 | OpenIDEA 0.1.43 | 面向事件流插件、受容量限制且绑定项目的后台 WebSocket |
|
||||
| 1.7.0 | OpenIDEA 0.1.44 | `views.open-diff`:在差异查看器中对比两段文本,例如评审中某个文件的修改前后 |
|
||||
| 1.8.0 | OpenIDEA 0.1.45 | `problems-changed` 工作台事件:宿主按文件保存每个生产者的诊断,注解跟着文件走,而不是跟着调用它的窗口 |
|
||||
| 1.9.0 | OpenIDEA 0.1.46 | 带环境变量和调试器的运行配置、向正在运行的语言服务器发送请求(`lsp:<server>`)、交给插件处理的服务器命令、编辑器面板 |
|
||||
| 1.10.0 | OpenIDEA 0.1.47 | `build.dependencies`:IDE 已解析的 Maven / Gradle 依赖图(`build.read`) |
|
||||
| 1.11.0 | `main` 上开发中 | `ui.read-clipboard`:在用户运行的命令中读取剪贴板的文本和图片(`clipboard.read`) |
|
||||
| 1.12.0 | `main` 上开发中 | `ui.set-console-rules`:Run/Debug 控制台输出的高亮规则(正则、调色板颜色、文本样式) |
|
||||
| 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 | OpenIDEA 0.1.52 | 可选 `completion-list-provider` 导出:标记为不完整的补全在继续输入时再次询问,不会重新询问语言服务器和其他插件;`decorations.set-markdown`:悬停显示 Markdown 卡片的行尾装饰 |
|
||||
| 1.17.0 | OpenIDEA 0.1.53 | `decorations.set-styled`:自带 `#rrggbb` / `#rrggbbaa` 前景色和背景色的编辑器装饰,用于主题调色板之外的颜色 |
|
||||
| 1.18.0 | `main` 上开发中 | `[[contributes.overlays]]`:悬浮在工作台上方、从不抢占键盘焦点的插件网页,可通过 `openidea.overlay` 移动和调整大小;`[[contributes.dialogs]]`:插件网页显示在可调整大小的模态对话框中,用 `views.reveal` 打开,关闭时发 `closed` 视图事件,页面可调用 `openidea.dialog.close()`;`events.subscribe-paths-with-options`(`debounce-ms`)、`workspace.project.generation` 与 `FilesChanged` 的 `project`/`generation` 字段、过期运行目标/配置拒绝以及 `project-closed` 生命周期事件;`execution-configurations`、`run.start-with-options` 与 `runDetectors.outputMode`:插件运行配置的控制台输出方式(`pipes` 或 `pty`);`[[contributes.runAnything]]` 与 `run-anything-provider` 导出:以插件前缀开头的 Run Anything 行;`views.open-terminal-session-in`:在项目子目录中打开带 key 的终端;`workspace.invoking-project`:本次调用所服务窗口的项目,`gutter-actions` 和 `hover-actions` 中也可用;`events.watch-paths` 与 `watched-files-changed` 事件:监听项目之外、`fs.read` 授权范围内的文件和目录;`run-configuration-completion` 导出:补全插件自己运行配置的“实参”字段 |
|
||||
|
||||
每个版本新增内容的完整列表见 [`plugins/README.md`](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md)。
|
||||
|
||||
|
||||
@@ -470,6 +470,12 @@ matching SDK. Plugins for 1.17 and earlier keep working. New in 1.18:
|
||||
launches can pass a per-invocation override via
|
||||
`host::start_run_with_options` (`run.start-with-options`). User-saved
|
||||
overrides win over per-invocation overrides, which win over plugin defaults.
|
||||
- **Completion in a configuration's Arguments field.** The optional
|
||||
`run-configuration-completion` export (`RunConfigurationCompletion`, registration
|
||||
`run_configuration_completion`) completes the Arguments field of the plugin's own
|
||||
run configurations in **Run | Edit Configurations…**: each item replaces one UTF-16
|
||||
range, so the other arguments stay as typed. See
|
||||
[Completing configuration arguments](#completing-configuration-arguments).
|
||||
PTY is rejected for `test` configurations, `debug` launches requesting `Pty`,
|
||||
remote run targets, and redirected `stdin` files. See
|
||||
[Output transport: pipes or PTY](#output-transport-pipes-or-pty-api-118).
|
||||
@@ -973,6 +979,7 @@ then run `openidea-plugin check`.
|
||||
| `RunConfigurations::configurations(root)` | export `run-configurations.configurations` | API 1.4: optional `plugin-run-configurations` world; SDK registration `run_configurations`. Full project list, refreshed on configuration listing. |
|
||||
| `LaunchConfigurations::launch_configurations(root)` | export `launch-configurations` | API 1.9: optional `plugin-launch-configurations` world; SDK registration `launch_configurations`. The same list with `env` and `debugger`; preferred over `run-configurations`. |
|
||||
| `ExecutionConfigurations::execution_configurations(root)` | export `execution-configurations` | API 1.18: optional `plugin-execution-configurations` world; SDK registration `execution_configurations`. Adds a default `output_mode` (`Pipes` or `Pty`); preferred over `launch-configurations` and `run-configurations`. |
|
||||
| `RunConfigurationCompletion::complete(project, config, field, text, caret)` | export `run-configuration-completion` | API 1.18: optional `plugin-run-configuration-completion` world; SDK registration `run_configuration_completion`. Completes the Arguments field (`field = "arguments"`) of the plugin's own configurations; items replace a UTF-16 range; 200 items, 300 ms. |
|
||||
| `TestResults::parse(config, chunk)` | export `test-results.parse` | API 1.4: optional `plugin-test-results` world; SDK registration `test_results`. Bounded output batches for `framework = "plugin"`; failures use built-in parsers. |
|
||||
| `TestResults::select_tests(config, tests)` | export `test-results.select-tests` | API 1.4: full replacement argv for test-tree name paths, or `None` when unsupported (the SDK default). Enables rerunning failed tests and running tree selections. |
|
||||
| `host::open_location(path, line, column)` | `views.open-location` | Opens a file inside the project in an editor of the invoking window, the caret at `line`/`column` (0-based, UTF-16): a view's links to code. Needs `project.read`. |
|
||||
@@ -1492,6 +1499,39 @@ with an older generation after the project generation has moved forward, the reg
|
||||
a project closes, in-flight work and queued events for that project are cancelled and dropped, run targets and configurations
|
||||
under that root are withdrawn, and `project-closed` (`Event::ProjectClosed`) is delivered to subscribed plugins.
|
||||
|
||||
### Completing configuration arguments
|
||||
|
||||
A configuration a plugin provides (a `[[contributes.runDetectors]]` entry or one from a
|
||||
configurations export) can have its Arguments field completed by that plugin in
|
||||
**Run | Edit Configurations…**, also after the user overrode it there. Export
|
||||
`run-configuration-completion` (API 1.18):
|
||||
|
||||
```rust
|
||||
impl RunConfigurationCompletion for MyPlugin {
|
||||
fn complete(&mut self, project: &str, config: &str, field: &str, text: &str, caret: u32)
|
||||
-> Vec<RunConfigurationCompletionItem> {
|
||||
if field != "arguments" { return Vec::new(); }
|
||||
// Find the argument under `caret` (UTF-16 offsets) and offer task names for it.
|
||||
// …
|
||||
}
|
||||
}
|
||||
register_plugin!(MyPlugin, run_configuration_completion);
|
||||
```
|
||||
|
||||
- **What the plugin gets.** `config` is the configuration's id as the plugin reported it,
|
||||
`field` is `arguments` (answer none for a field you don't know: later IDEs may ask for more),
|
||||
`text` is the field as typed and `caret` a UTF-16 offset into it. The field splits like a
|
||||
shell command line: whitespace separates arguments, `'` and `"` quote.
|
||||
- **What it answers.** Each item has a `label`, an optional `detail` (grey, such as the file a
|
||||
task comes from), an optional `insert` (default: `label`) and the UTF-16 range
|
||||
`replace_start..replace_end` it replaces. Replace only the argument being completed, so the
|
||||
other options, quoted values and the arguments after `--` stay as they are.
|
||||
- **Limits.** The IDE asks while the user types (and on Ctrl+Space). Answer from what the plugin
|
||||
already knows, without starting a process per keystroke. It keeps the first 200 items, drops
|
||||
items whose range is outside the text, and drops an answer slower than 300 ms or one for text
|
||||
that has changed since. A configuration the plugin no longer provides for the project (its
|
||||
program revoked, the plugin stopped) is not completed. A failure leaves the field as it is.
|
||||
|
||||
### Watching paths outside the project
|
||||
|
||||
A build tool's configuration often includes files from outside the project (a shared Taskfile, a
|
||||
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
fba23503b3a73d9d20277f5347f3421c44f109e0d07c5bb212345ba180bbe3dd
|
||||
81f868bbdc6d1962a210d80c0bcc3d308aae4778074a7c0fc186f63c2ff61eac
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
fe0829e3c34b2a2a3dcf8fc15fe5f204dcb8b1cb3b0ad8d69433313f2f7cbbe0
|
||||
f7fe1f6c6dd7d0ca6d6d00822e9befb2be9dac290e43857fa34e25da58ea3404
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
dfb8ad40626f5595425618c62382d25aa374110927c8839124959e3fcc27e61e
|
||||
160dc378e930f137643b36a28a6eba4da6c1fa67e15348e82df93904a8cd6eeb
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
4a579b4009c1da637b91946137dff03c576a9b5116ece590de4c98c1dadf9aa0
|
||||
84c49b6c40314c5b8f4f366d51575abda6b3645d60010a2f6492bba9e18fa62a
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
918b5e2700a36a63af100203b04654fbedfc7e244c89de4fc916fae448b34e00
|
||||
50d106a7b96c240652da5f25f0e2fc083a135c587879080687eb72a5b3d90769
|
||||
Loaded 100 of 134 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Заблокувати користувача