дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 11:15:40 +02:00
feat(plugins): allow prompts while resolving code actions (#2025)
Closes #1945 Resolving a lazy code action or file action dropped the invoking window, so a plugin couldn't ask the user anything (input, pick, confirm) while building its edit. Resolution now runs with that window, so prompts work during resolution; previews and Actions on Save never prompt, cancellation keeps the text unchanged, and stale edits are rejected. WIT and SDK docs describe the new behaviour; the released API surface is unchanged. Co-authored-by: arnaud-ritti <[email protected]>
Цей коміт міститься в:
1 джерело
0b88599463
коміт
9e6cb7b93e
70 files changed
+559
-82
No files matched your search
@@ -400,9 +400,9 @@ 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::pick(title, items)`, `pick_many` | `ui.pick`, `ui.pick-many` | Picks key(s) from `PickItem`s, or `None` when dismissed. From a command/event or code-action resolution in its editor window (else `invalid`); waiting is excluded from the budget. |
|
||||
| `host::input(prompt, value)` | `ui.input` | A one-line text box pre-filled with `value`; `None` when dismissed. Same rules as `pick`. |
|
||||
| `host::input_multiline(prompt, value)` | `ui.input-multiline` | A multi-line text box pre-filled with `value`; `None` when dismissed; Cmd/Ctrl+Enter confirms. Same rules as `input`. |
|
||||
| `host::input_multiline(prompt, value)` | `ui.input-multiline` | A multi-line text box pre-filled with `value`; `None` when dismissed; Cmd/Ctrl+Enter confirms. Only from a command or event of a window. |
|
||||
| `host::confirm(title, body)` | `ui.confirm` | OK / Cancel; `true` on OK. Same rules as `pick`. |
|
||||
| `host::locale()` | `ui.locale` | The IDE's UI language as a BCP 47 tag (`en`, `fr`, `zh-CN`); no capability. See _Translations_. |
|
||||
| `host::log(level, msg)` | `log` | IDE log, tagged with the plugin id. `eprintln!` output is logged too and shown when the plugin crashes. |
|
||||
@@ -522,7 +522,12 @@ can be a `snippet` (`$1`, `${1:name}`, `$0`), match on `filter_text` instead
|
||||
of its label, and bring `additional_edits` elsewhere in the document (an
|
||||
import). A code action can leave `edits` empty and set `data`: its edits are
|
||||
then computed by `resolve_code_action` when the user picks it, under the
|
||||
command budget instead of the 50 ms. A quick fix that creates, renames or
|
||||
command budget instead of the 50 ms. During resolution, `pick`, `pick_many`,
|
||||
`input` and `confirm` ask in the editor's window; waiting for an answer does
|
||||
not consume that budget. Dismissal returns `None` (or `false` for `confirm`):
|
||||
return `Error::Cancelled` or no edits to abandon the fix. Lazy plugin actions
|
||||
resolve only when invoked, never for the intention preview or Actions on Save. Commands/events-only
|
||||
APIs remain unavailable during resolution. A quick fix that creates, renames or
|
||||
deletes files implements `file_actions::FileActions` too
|
||||
(`register_plugin!(T, providers, file_actions)`; the `code-actions` kind
|
||||
covers both): a `FileAction` carries `operations` (`FileOperation::Create {
|
||||
@@ -531,7 +536,7 @@ workspace edit, so a failure changes nothing and one undo reverses it. A path
|
||||
outside the project root disables the action; `open` shows a file once the
|
||||
action is applied. Like a code action, it can leave `operations` and `edits`
|
||||
empty and set `data`: `resolve_file_action` computes them when the user picks
|
||||
it. File actions are new in API 1.3. Problems (`publish_diagnostics`) can name
|
||||
it, with the same prompts and editor window as `resolve_code_action`. File actions are new in API 1.3. Problems (`publish_diagnostics`) can name
|
||||
the tool that found them (`source`) and be `unnecessary` (faded) or
|
||||
`deprecated` (struck through).
|
||||
Editor providers run under the edit-path budget: 50 ms, after which the
|
||||
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
35df068fc8ad60d011ac0280618fd4db7afddbd799f9d5cca0dab6798e85a4a7
|
||||
5325c5c915e66d12cc47afc55b29e18e531a3f533e69c51933413f4f77a74438
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
01349e8fa8cba37979443c72aab247a49e85c8402ac67eae3e7e8d952b4715e7
|
||||
d23b9b067928d6e7648a4989b09e201cade971a67ab769b4d583a274f4e071ac
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
1abd2598304ddfca641d022de63709a5e4914b7968a57aad40c317137a59514d
|
||||
a49ab90f826a214d7de7058164f1fd886d9b762482c94953ee07495833742f92
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
97efbeb8209eed4449ca850e985acefac08b44bb1f13853b313b836e996583a3
|
||||
29f7f3bd8b35edf079fdac3c4cc67c5b5ffd57c999064a9ee55793f4f22b6c6b
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
0f5e465f98d98f8ff129bd72b98109fb8246d45ff00104d48375168ed8fe2086
|
||||
a008cd053e851f86be07576b21c0a0a763cb8e239e7bba03127de0d7c5ab3a4b
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
6e23467236adfdca5025184e8cad45df47bba736f010a46d13ca88dc0ac2e897
|
||||
a598e79d3e15b7ce4c5fef6b0af56d7d17e572bc1736806bbfa93349126dfb33
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
b0ee4c5d79f32b5420930ef767c983ee405157893ecdc340211b8777f8a02e44
|
||||
481910e4fe978ad5060cc70dd9d66dda029f4f73a0e8cd172b78df85dfa6dcd1
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
009452617b429df61dfaed6b1a96b0906342f3e0f0ccd8fb4b57ae74f3621b6f
|
||||
a667fe84ceda6c32f4e74e86b39c39f9c0c7654e07ff911a294dae44a3e15c23
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
1c55ec95537d31885c1f860a2c3a02ea4f840b4d97cd78977df5701a3a439c8f
|
||||
a59169bbd1e95017f28f92c9b8796059f0804c9361f1ec39d9ff2ec3fc7ca3ab
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
8d0eff09f96dc06f83af99d768e1c13d189b9b20cf481933c4f0bc6c47d5081a
|
||||
fc5e1ed12c0238b7d9bc0621e41beb89bd62191fe0f30b8c66554207cde9cdf7
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
6a3d219b86eb112ee16aa846f97a17df4f3270ddfa90b5aa7ebe073b3a426d35
|
||||
343c6d46b9bf07f8631f16dbc737301a02a6b229b17eb0a455207509823680e1
|
||||
Reference in new issue
Заблокувати користувача