feat(plugins): let a command ask the user with a picker, an input box or a confirmation (#1779)

Plugin API 1.2 adds `ui.pick`, `ui.pick-many`, `ui.input`, `ui.confirm` and `views.reveal`. The dialogs show in the window whose command or event asked and block that call until the user answers; the wait is added to the call's deadline, so it doesn't use up the time budget. They need no capability and return `invalid` without a window (events without a client, rendering, editor providers). Prompts are withdrawn when the call is cancelled or the plugin stops, and reach remote windows through the dispatcher (`plugin_answer_prompt`). `views.reveal` brings one of the plugin's declared views to the front. The Rust SDK and its mock gain `pick`, `pick_many`, `input`, `confirm` and `reveal_view`. All components are rebuilt for the WIT change.

Closes #1768

Co-authored-by: arnaud-ritti <[email protected]>
Цей коміт міститься в:
Arnaud Ritti authored and GitHub committed 2026-11-06 23:18:30 +08:00
1 джерело 52eed40fc8
коміт abdbc39d0d
43 files changed
+880 -42

No files matched your search

+4
Переглянути файл
@@ -357,12 +357,16 @@ then run `openidea-plugin check`.
| `host::notify(level, title, body)` | `ui.show-notification` | Balloon in the window the command or events came from (every window otherwise). |
| `host::copy_to_clipboard(text)` | `ui.copy-to-clipboard` | Copies `text` to the system clipboard. Needs `clipboard`. |
| `host::open_url(url)` | `ui.open-url` | Opens an `http://` or `https://` URL in the user's default browser. |
| `host::pick(title, items)`, `pick_many` | `ui.pick`, `ui.pick-many` | Asks the user to pick from `PickItem`s and waits: the chosen key(s), or `None` when dismissed. Only from a command or event of a window (else `invalid`); the wait isn't charged to the time limit. |
| `host::input(prompt, value)` | `ui.input` | A one-line text box pre-filled with `value`; `None` when dismissed. Same rules as `pick`. |
| `host::confirm(title, body)` | `ui.confirm` | OK / Cancel; `true` on OK. Same rules as `pick`. |
| `host::log(level, msg)` | `log` | IDE log, tagged with the plugin id. `eprintln!` output is logged too and shown when the plugin crashes. |
| `Project::find_files(glob, limit)` | `workspace.project.find-files` | Project-relative glob (`**/*Mapper.xml`); honours `.gitignore`; at most `limit` paths. |
| `host::publish_diagnostics(path, items)` | `diagnostics.publish` | Replaces this plugin's problems for the file (editor squiggles and the Problems view); an empty list clears them. |
| `host::fetch(request)` → `{status, headers, body}` | `net.fetch` | See _Network_. |
| `Project::run_process(program, args, stdin)` → `{code, stdout, stderr}` | `process.run` | Only the pinned program of a `process:` grant; runs in the project root of a trusted project; 4 MiB of output; killed when the call is cancelled or times out. |
| `host::refresh_view(view)` | `views.refresh` | The view (or custom editors) render again; call it when the content changed. |
| `host::reveal_view(view)` | `views.reveal` | Brings one of your declared `[[contributes.views]]` to the front in the calling window. |
| `host::post_view_message(view, text)` | `views.post-message` | To the script of the view's `html` body. |
| `host::open_terminal(title, program, args)` | `views.open-terminal` | A terminal tab in the invoking window running the approved `process:<program>` in the project root: output that keeps coming, interactive sessions. |
| `host::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`. |
+1 -1
Переглянути файл
@@ -1 +1 @@
b143041299679ec90d16a35c6eaae4c2525648bc33f06c40d72fba7f63fb1ab2
fd5d8c0b9c6828bbeb0a93e394a0468abe83f051d1c20e50a7ac91fe12d5ab68
+1 -1
Переглянути файл
@@ -1 +1 @@
f87528deb3a497c841456b158d46f22fbc05909dfe4b886ed222c2e86dc824ba
eb4d8c5d84dd2ea0171297f756cdf56bf72d3db88b8f4736bc2b3ab8346bd5eb
+1 -1
Переглянути файл
@@ -1 +1 @@
ec737f2490193fb319e28ec7d44f49cb64e6c75fdea67b44288899f7a6385e95
5db8c9213f6bef54f92c39c994717c8dfd4623a46b615293fe10b7a2990014a9
+1 -1
Переглянути файл
@@ -1 +1 @@
130a82376feeb0a3879d110b4ec2417b0ae6839088b6a8ba42b101869c6248d8
b95b4b5c2e4451e670d1b013ad03662469456de03fabdbd8a3c62eccd93fb0f0
+1 -1
Переглянути файл
@@ -1 +1 @@
9d7d6995e4f6eb96a669a11f9c75e2c77f2663eb905275346e77d20c6dd5d929
6b800f268041ebb169117dfa31eead60315f51ebd92e409751f2670c92eac473
+1 -1
Переглянути файл
@@ -1 +1 @@
8225d25b08f9ec36b36a850d1a99a43643a3c06a3e9d6c835e75fb269eeac61a
6a2c0c1f354b9c8defbcc9ec4a098fd956991dfb656ef2a4df92a219e60102d7
+1 -1
Переглянути файл
@@ -1 +1 @@
8de2b1598c2b9f8438a901c70197ba90ef6e85c3f510125e8bb72b002d25d7f6
341466108d3a98c295a33d56c6f2a11736ced33dc0c4358d395cb376c24be663
+1 -1
Переглянути файл
@@ -1 +1 @@
e9cd442b032d0521e0b3c733a3a9866a203ddf5bacb381396f5a0a6c508de5ca
b3c715c1d3489db1c9f6067f66aa31623ffd23ac6ad9d9fb9cc3b5d548088473
+1 -1
Переглянути файл
@@ -1 +1 @@
3e4bd05682cf1b748ab7189b17b8937eaeb332641804da59ee684db9ad848579
6e1490c35f7094221a856cf23ba2b6dab92bf8e8c130b156aad1a0ef68a52086
+1 -1
Переглянути файл
@@ -1 +1 @@
3b2892a7629ed255add98ebd88e4a1fc454720ee9cae9bf4ffa74fa9b570adff
ce28fb9dfa83dfc46bc6215f9517e2b339b34b40abb85fe12b9534fd63a76899
+1 -1
Переглянути файл
@@ -1 +1 @@
6183df09a561bc715ec353223b6ae76d0280c179191621e2d0ef809b7b3b2d32
d2b50d6ee2fe2a0991b7a0006c4899930cfb884f32db231f99c3144ef7f7d0d0