feat(plugins): deliver batched filesystem events (#2049)

Closes #1948

Plugins receive debounced batches of files created, changed and removed outside the editor in open projects, as SDK `Event::FilesChanged` (delivered through `other("files-changed", …)`, so released WIT is unchanged), under the `events` capability and the plugin's path filters. Activation on these events requires API 1.3. Batches are coalesced per plugin through its actor, survive cancellation without losing deltas, and are dropped when the project or host shuts down.

Co-authored-by: arnaud-ritti <[email protected]>
Цей коміт міститься в:
Arnaud Ritti authored and GitHub committed 2026-11-08 07:25:01 +08:00
1 джерело 7ecb452350
коміт 63065bab64
123 files changed
+1832 -97

No files matched your search

+19 -2
Переглянути файл
@@ -502,6 +502,7 @@ from another feature, or nothing when run from Search Everywhere / a shortcut. `
| Kind | Capability | Delivered |
| ------------------ | -------------- | ------------------------------------------------------------------------- |
| `file-opened` | `events` | a file opens in an editor |
| `files-changed` | `events` | debounced created, modified and removed paths in open projects (API 1.3) |
| `file-saved` | `events` | after the file is written |
| `editor-focused` | `events` | the focused editor changes (path, or none) |
| `vcs-changed` | `events` | a repository's state changed (commit, checkout, fetch…; its root) |
@@ -510,7 +511,21 @@ from another feature, or nothing when run from Search Everywhere / a shortcut. `
Events are batched: a running plugin gets them within a fraction of a second,
an idle one collects them for 2 s before it is woken, so frequent events
(Key Promoter's actions) don't keep it alive.
(Key Promoter's actions) don't keep it alive. `files-changed` is already debounced
by the project's watcher (100 ms quiet period, at most 1 s during a continuous
burst), so it bypasses the idle delay. Queued filesystem batches coalesce paths;
a later batch does not cancel an earlier one. Closed project sessions discard
pending filesystem events. Excluded and git-ignored paths follow the normal
project watcher rules; scratch files and language-server dependency watches do
not produce this event.
The released WIT event remains unchanged: `event::other` carries kind
`files-changed` and JSON `{ "created": [...], "modified": [...], "removed": [...] }`.
The Rust SDK exposes `Event::FilesChanged(FilesChanged)` and
`EventKind::FilesChanged`. Paths have the same absolute form as `file-saved`.
Subscribe with `host::subscribe(EventKind::FilesChanged)` or
`activation = ["on-event:files-changed"]`. Plugins using this event must declare
`engines.openidea = "^1.3"`.
Kinds are names (`subscribe` takes a string), so later IDEs add kinds without
a new API: an IDE refuses a kind it doesn't know with `invalid`, and a kind
@@ -519,7 +534,9 @@ The SDK's event enums are `#[non_exhaustive]`; match them with a `_` arm.
API 1.3 adds `host::subscribe_paths("file-opened", &["config/*.yaml"])`
(`events.subscribe-paths`). The host matches project-relative globs before
queueing an event or waking an idle plugin. `file-saved` works the same way.
queueing an event or waking an idle plugin. `file-saved` and `files-changed` work
the same way. For `files-changed`, each category is filtered and an empty batch
is omitted; replacing or pausing a filter also affects batches already queued.
Patterns use `/`, `*` stays within a directory, and `**` crosses
directories. Up to 64 patterns of 1024 bytes each are accepted; absolute paths,
parent traversal and malformed patterns fail without replacing the old filter.
+3
Переглянути файл
@@ -98,6 +98,8 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
name = "openidea-plugin"
version = "0.1.0"
dependencies = [
"serde",
"serde_json",
"wit-bindgen",
]
@@ -150,6 +152,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
dependencies = [
"serde_core",
"serde_derive",
]
[[package]]
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
710e95defa1995356f259b1fd69c7df8cfe1d0c1c55b04df0f0d7173b7cb61b9
978b1af84eae4b6ac381e1991241a11d6a416f3f45856bc0ad985ed59435b67d
+3
Переглянути файл
@@ -98,6 +98,8 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
name = "openidea-plugin"
version = "0.1.0"
dependencies = [
"serde",
"serde_json",
"wit-bindgen",
]
@@ -149,6 +151,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
dependencies = [
"serde_core",
"serde_derive",
]
[[package]]
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
145b164b99c18b6e9d0d0c2704fff0fa878fc56761d5cb76669a2a0cc9ddb3aa
5125e2e47c9adf8043d82fb60b9810fd3edcef272ff4a6c41b2450e19617d8cc
+3
Переглянути файл
@@ -98,6 +98,8 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
name = "openidea-plugin"
version = "0.1.0"
dependencies = [
"serde",
"serde_json",
"wit-bindgen",
]
@@ -149,6 +151,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
dependencies = [
"serde_core",
"serde_derive",
]
[[package]]
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
897d2b653cb5b8a91ef806307efa6fefd773c0aaacc746bf87fd7d2bea4bf147
4fc2c8ca94ee5e45999c68285a124f535cde6f612aac319f04526acceb639339
+3
Переглянути файл
@@ -98,6 +98,8 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
name = "openidea-plugin"
version = "0.1.0"
dependencies = [
"serde",
"serde_json",
"wit-bindgen",
]
@@ -149,6 +151,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
dependencies = [
"serde_core",
"serde_derive",
]
[[package]]
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
9724a33ae85205245ec0bb94369d55e2df08aa328e872af2c03ad45c230d7865
8cd633605b641e53cb27b61ce7648ab161671a334e6c5fcaba4a7c27c332612b
+3
Переглянути файл
@@ -98,6 +98,8 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
name = "openidea-plugin"
version = "0.1.0"
dependencies = [
"serde",
"serde_json",
"wit-bindgen",
]
@@ -150,6 +152,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
dependencies = [
"serde_core",
"serde_derive",
]
[[package]]
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
d5245ffd43097795062f7bb887162c13d99d48b68f7883e4ff6adb41a663d157
48525c9df30fce0a443dadbfb85dd6f69e56dadbe9c529cfe4274ef24ac19a3b
+3
Переглянути файл
@@ -98,6 +98,8 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
name = "openidea-plugin"
version = "0.1.0"
dependencies = [
"serde",
"serde_json",
"wit-bindgen",
]
@@ -149,6 +151,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
dependencies = [
"serde_core",
"serde_derive",
]
[[package]]
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
2fbf40065eae7c9ef0e927dfae4fde1f698858b2ae3047db9c242a12e443d823
de4355361ad2f4b0950669ca41b17752bc7b67fc24a5eb40a2ffc7e75fe62441
+3
Переглянути файл
@@ -98,6 +98,8 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
name = "openidea-plugin"
version = "0.1.0"
dependencies = [
"serde",
"serde_json",
"wit-bindgen",
]
@@ -149,6 +151,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
dependencies = [
"serde_core",
"serde_derive",
]
[[package]]
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
7b5480ba83b888a43bb641f95ad679d60b132548516b92d91d8d7e118220f2c3
cba6d696b5984ba62619982042e496c39afcc2e97d8093872a9c7e0522d30b8c
+3
Переглянути файл
@@ -98,6 +98,8 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
name = "openidea-plugin"
version = "0.1.0"
dependencies = [
"serde",
"serde_json",
"wit-bindgen",
]
@@ -149,6 +151,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
dependencies = [
"serde_core",
"serde_derive",
]
[[package]]
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
6762b2c436f8dd0a586759cbf0b2cc316560f581619fc32efb717f96505f720b
a735b01070abd15165d221f994d712e199a4468f50c637d5c704d13639f2643a
+3
Переглянути файл
@@ -107,6 +107,8 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
name = "openidea-plugin"
version = "0.1.0"
dependencies = [
"serde",
"serde_json",
"wit-bindgen",
]
@@ -189,6 +191,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
dependencies = [
"serde_core",
"serde_derive",
]
[[package]]
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
f8e3d365d62382437b4af9d7889c135725cf437bb1ec3a1144466af72ef8f859
01d43147d97f29798681450bfc75a1ef9cd578ede283012aecc09665234e9bce
+3
Переглянути файл
@@ -98,6 +98,8 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
name = "openidea-plugin"
version = "0.1.0"
dependencies = [
"serde",
"serde_json",
"wit-bindgen",
]
@@ -149,6 +151,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
dependencies = [
"serde_core",
"serde_derive",
]
[[package]]
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
9e8e7a1fc6aa73e11655114e4cf8c642ea6ea2318b0711fb4e1a82fb0f353bae
924d3e7316d6d6e4dd8c371a1485df3215d9b2e71c27e7c683edb613fd1bee1a
+3
Переглянути файл
@@ -98,6 +98,8 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
name = "openidea-plugin"
version = "0.1.0"
dependencies = [
"serde",
"serde_json",
"wit-bindgen",
]
@@ -149,6 +151,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
dependencies = [
"serde_core",
"serde_derive",
]
[[package]]
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
428dd3b2ebc9bc248775e385fc431f0621e564533ed54f70d12bf5db950627cb
3ff5852da7219a878efa8dc4d47b69b314d7ccfb1403c2ff2522aaeaba5ea9e2