Порівняти коміти

...
Автор SHA1 Повідомлення Дата
l0ng-ai 47f8805045 fix(plugins): say which project a document-changed path is relative to
document-changed hands plugins the path relative to the file's own project, but
not which project that is. With two open projects holding the same relative
path, a plugin could not tell which document changed and cleared or kept the
wrong per-document state. The event now carries `project`, the root the path is
relative to, and the SDK's DocumentChanged exposes it (None from older IDEs).

Plugin components are rebuilt for the SDK change.
2026-11-18 22:12:29 +08:00
101 змінених файлів з 84 додано та 50 видалено

No files matched your search

+3 -1
Переглянути файл
@@ -162,7 +162,8 @@ impl PluginHost {
.collect()
}
/// What a plugin receives for `document-changed`: the path relative to the file's own project.
/// What a plugin receives for `document-changed`: the path relative to the file's own
/// project, and that project's root, since two open projects can hold the same relative path.
pub(super) fn relativize_documents(
shared: &super::api::Shared,
client: Option<&str>,
@@ -181,6 +182,7 @@ impl PluginHost {
.to_string_lossy()
.replace('\\', "/");
change.path = relative;
change.project = Some(ide_core::ipc_path::to_ipc(&root));
Some(WorkbenchEvent::DocumentChanged(change))
})
.collect()
+3
Переглянути файл
@@ -5298,6 +5298,7 @@ fn document_changes_reach_plugins_relative_to_the_project() {
let deliver = |path: &str| {
let change = ide_plugin::DocumentChanged {
path: to_ipc(&f.project.join(path)),
project: None,
base_version: 1,
version: 2,
changes: Vec::new(),
@@ -5311,6 +5312,8 @@ fn document_changes_reach_plugins_relative_to_the_project() {
// Queued with the absolute path, filtered again at delivery, handed over project-relative.
deliver("config/app.yaml");
assert_eq!(f.run("test.path-events", "document", None).unwrap().as_deref(), Some("config/app.yaml"));
// With the project it is relative to: another open project may hold the same path.
assert_eq!(f.run("test.path-events", "document-project", None).unwrap(), Some(to_ipc(&f.project)));
}
#[test]
+3
Переглянути файл
@@ -250,6 +250,9 @@ pub struct DocumentTextChange {
#[serde(rename_all = "camelCase")]
pub struct DocumentChanged {
pub path: String,
/// The open project `path` is relative to, set when the event is handed to a plugin
/// (the editor posts the absolute path and `null`).
pub project: Option<String>,
pub base_version: u64,
pub version: u64,
pub changes: Vec<DocumentTextChange>,
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
c10d6f373bd3a701e201350d0272a211da72b23cef010144760db5bae44e2c11
ada68dfdf2875668eff1765ec22678315f18ac6f1364c5f7eda742cb58dc3c60
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
cd7a14b6d4464a559c197ba7fcba30fb045a8927c074fd0c310bec6039af0e0f
2279ae4f79c565c4cd59d9191f394c4d7d5b23ef955f1bd30c2e5396d608e46c
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
017cb719d8c3a226cb6178d75da7ae0396b2d78799658ef560f729e8e06f36e3
77be736c11c39de3a1b021a5e66e905c76e2d32352d889d6bcc9315607c54271
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
93a9660a0941f2f57d11ea7ae331bd6d209ddcb134729ee88ec2fd96e978e631
304690bf13cba5d262d54d709d6f18c627880954f0140919118aea0439fbaaf3
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
6a0008339af0935c7c0128d23bf3e885a642c335ad57097cffb3f000766aba33
b24767627e7445ec093cc79cd6c18844e4dcdf123c6b04c24bc37f109c5cdb0f
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
09369df431bb6922463a242484eb82325ce8af287654af97a99eefb3884115a5
0fa52a91772ceb3d45307db4f2561c132df4b966d15f7f9ce177b7a373f7163d
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
897898835f2f42763da34dad29b8f926b230b33f506830e4118e6c5914720bd4
34ea07edc731ab28748b99c398f7e1ee4d41aa22c0760d57027adad40759292f
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
b56b918d1ff51c902dc956a7da944163194fcc93ba5bcf8baafa44fc2b6b039b
470a54d825e84e8ec0418a244c1fc46426c02f299f4a456ff4cc83fa604d08a0
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
ec2f6463d1ce5d70ad7331ae51bca3c8205b55f1f9e5abfe2218d53be2b61437
20a4f662437478b20e5a80aa30afe20b155001f94c2934843ab11b69192833d4
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
8a25727e09b96b35bc90f906215e13d29697b3792ed81f7f80024299e8b23d44
c118a6562e0398e7f0deb64abc9913dd14acec74869d5c04c452923a81455463
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
33d331d6ab59aa44f9884504ecc77a474e99c7223253735983c327bee6e75984
194fa719b8c96ca23f2da73d2d7225c4805b5c48af67b1efff8e76852f0a6a1c
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
b804f22b06f924aebce86f8bc2c24b5306913f2d2a4a0167af10ce86c8f606db
3db661dd4d45a242b79caf642510d71841ba9f09b3b5eaa1854eabe9fcf6292e
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
27e24e96578471e51dace84968daa6ee189aae0d63d27f3054bf4f3a0841fe0c
196769808ae37ede0a7564f42cae087a18f756b3cd31acb7d99470f1bfd70ea6
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
283320b057d39decafce4f86e09ace4df46ef2f31524b6cac0af22bd62795b0c
dcd05de6c207f4594d347ad3dc44089204353dc898e53873f437e3db1928d629
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
dff4f3571bf72eedfbe2e0e2d6b8908e703e890639fb1b854eb4f35226ddbc98
ece50a864d5a85263cb30eb39dceae90fe174336904e9208ae5c9d5da5cbb036
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
f5d7f62056547beffaadf68a04e8393ee29d73d57501d9f8bb39e902e9d9bf61
a2854d3c357d976b5ee1bf7b31fa541a55581102d37ec85ea719d4fdedd962cb
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
8ea7d2a041efe6bcabe8f9bb58b216fe583a7ad39207f0f10b4bf423facc56e7
dbebe5cfa79092169689d43945e4d71e1a61303ce88f6b4f02216ab69083b955
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
3b5b541b94b674762d6c0494bb5e26bbc871460767015a669ecd2771dc063b8a
993b0f11e8cae470b0529fcfcbe9a520c855069ef63f242da3b26a3da2574d5d
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
64411ddd70ae2906710d03c90add26727aa319db38c5bd23971eb442943154c5
d803928d82cbb2991b3f0c53b73dbe2da625b7b2ce25050706b6da09687f2873
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
ff7468eabf0b09be01afda83ede9d8b540d17cbccb414e1972899bb851c19d84
1c779c4913a2b83fa51980ee0017e3f2625041f1b4de921cedcdcb3bd4120d67
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
b24fb8d5161006104698fb07a43432601b4f16fdc4a34cc70058cbef7e973066
bd09f3b47470087095ae50c3b0f134c471dd9ba1e5f812cd0285cef904065725
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
8ded9b882110bc6b1235b14797128d5999f20079178a6134f172f64f77922985
ada14d3aa0e462478de7dff28be356b2105f4d3ec8d4dff8a7a4a858d15c4613
+4
Переглянути файл
@@ -33,6 +33,10 @@ title = "off"
id = "document"
title = "document"
[[contributes.commands]]
id = "document-project"
title = "document-project"
[[contributes.commands]]
id = "count"
title = "count"
+2
Переглянути файл
@@ -33,6 +33,7 @@ impl Plugin for Fixture {
}
"count" => Ok(host::storage::get("count")?),
"document" => Ok(host::storage::get("document")?),
"document-project" => Ok(host::storage::get("document-project")?),
_ => Err(Error::NotFound(id.into())),
}
}
@@ -42,6 +43,7 @@ impl Plugin for Fixture {
for event in events {
if let Event::DocumentChanged(change) = event {
host::storage::set("document", &change.path).unwrap();
host::storage::set("document-project", change.project.as_deref().unwrap_or_default()).unwrap();
}
}
}
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
c38f6ca9e44f0a0674b9186ef105e73e0c66a914de92a1aec97b5985f31fc29a
3d628f747d13d3d2fae9a75adeb951c8af09b1db5fb15523fc71289857d97d99
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
a74d851ebf2cad085b9d0fb56ad26c7b18d737c8cc0ef32a592a8f1b05b9be06
43e7552ae0f8b42383cade84924adc81952c78253186a71c2693b11d98f01acd
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
ce5fc1e202210942f287b593fbb88f2f1d51b573702c476e9f2d96f684d546c6
373188558b7925b4f9c9f975b0b6aa7b13acdf8da0c622a4ab12f39b69c1f071
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
a9821d31a040a5b2244e205632bc4edf8ebeae5c34aa5911438b69254f767183
9c91a083fd31e57658f28c34329e061dc17cc08871fe09b3b96fa557bc085c8d
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
792cd02805a24a37655629a24da97d82c2cc4f385dea21720167792302a75236
1a2182ca4e272d3473084451932a1d8df861ac2e67ad1814c0e01e089584ab3f
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
e6235b32744d6e5b3042ff2231e1a30eb4966324e790d01176f88fc9955db638
d5e8c538e410f480d79454c616bf9b0e7eaa7e502ed0268bf20f75214ca93d17
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
c277285eab80d917597ca26bcee94c5bde17cb7d0d38f3bd2866ce75b048f226
756f2a459f2aa17d6eb1d9dbe089a3d6dc5079012ed68ee47e55d5256c589359
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
84e2be128daa6dbe04df383fee1250cd2b6d65d90a3de2afdaed98be147599cb
28327a76a68737fda8ae0b22a439f5bbe86dd53347a7ee2806bb66ae90714238
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
3a492f0664ed153d631ec3c1089e7bdf5dcf31f969cb75654516290ac35cf984
ac3a564273429fcaad2c443e3463f06694953889ad894c9f68b824e87e291ae0
+4 -1
Переглянути файл
@@ -1196,7 +1196,10 @@ 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`, `document-changed`
and `files-changed` work the same way. For `files-changed`, each category is filtered and an empty batch
and `files-changed` work the same way. A `document-changed` path is relative to
its own project, which the event names in `project` (the root's absolute path):
two open projects can hold the same relative path, so key per-document state by
both. IDEs before this field omit it. 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,
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
3527a73b71c5cab6c694ccf27a60d621fd8cd5e5f238a4f36cb0fa2dd107209d
1f41ef42ab398d26e480532e226f7ac904dad06be140d0e4265bd9dd55effda8
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
61445c4d44cb6ea511bcc350259a8dd131a911ba2edd9a660870d420130df634
919dd2ca7fd59ce0e9faed6cebaf744cbf4a30d684cff2ed12a7e898bbaeae78
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
61f7cd994ea48fbc0e6df883ef8f380bec88dc7e650fda09c000a6d30b8a18c4
4b5517eee830ed31e891c8610e47d0e5008bb64d50a6cf2dbb5ba8cd46b7dac0
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
5b9de883dd2c1ae75f3df81fd4866f287402f7535f681f909725866ebc7a9f33
6152757fa5d2066d215de2a37c1e6487d29df15732def6974ac6d7b0e0be77fd
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
29b1f11a24ef5d4c623ff82a485da8700f615e2bde6bef623c3e879ed0ea6c8f
a949f2795bc8e05824ef635692677b8b888da8efd2c81fb489210ba636864549
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
fd5c43974968bb1b1a7795a5abe51013f04700bd3db6edb3341ecb2edd4c8cd7
7a69f72d0c0b773ba809ff2cbfeb861c1e5b8d4ed478dcf39933e5afa208471b
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
69fd2b69107a28034239313930f6fad5193595b5a1d1a87428caf36077312ac6
fe8d6103f2a55ffc3a54e342a90c585bec2b9e40bd4b4578de6449502b0ab56a
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
90b244b1402b1a05d7555a8aba8d75bdba10f860d0abb200d5e0e00b494fa438
03a26f5be2c297859a70800b8767cc5f6a9c271a4661aa9f73a915cfa70f3605
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
bda40e216029ddff6f3ec97c334cb5bcedb8b150aa33dd90fdf808b0176094cd
ef9a9a25be41c19d1869de9c84d23799179fac50a0ee4926dd03c72866c46814
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
45a9310ea92dbae57b675a55a3e765813e9503dcbad530846b072d7b4b3e31c3
768afc28a197dd74c28b39bef5b168608a37c06126266d681245d8b42b98b28b
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
0838bbb165cbe30e799c4f904e724d17115db77f4677bfbd307444394e9255cc
ff5f3d964c70cecd5db12a0c048cb3f3fd5236fa87e331a1a73a571bba384940
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
6061c033c62748a1295c70a960ee0ddc9fab91042f4f2fb43f580f45816643b1
28a6da878ecb9361a88ade7c598b45daafc9819ee39efa9f59752fc549540fa9
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
bba433794559a12e407ca3d4bace7b9b00215b0499a940142b0a9e40913bbc59
e066194c8d48dd1572e855138eb9e0ed90f1228b66eec298307c6c6257e7aa43
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
934ca1988ec5c2022adea80498d445f5f55c542a8fa5658fcd9dfc72f5517cea
71909a43fef3822f378ba3d226e9c82b2656e0b1414a6960e971381f44baadd1
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
edf82d0aac5f7a66de25ff56b51b4c157d97eb0605a0ca4516f1168c1890ed10
2d4a3d5f9e3cf2654f1028ab68c7d24a12a56a46cbb516d09e2a45d4e688be4e
+13 -1
Переглянути файл
@@ -302,7 +302,13 @@ pub struct DocumentTextChange {
#[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DocumentChanged {
/// Relative to `project`.
pub path: String,
/// Root of the open project `path` is relative to (absolute). Two open projects can
/// hold the same relative path; pass this project to `document-at`. `None` from
/// older IDEs.
#[serde(default)]
pub project: Option<String>,
pub base_version: u64,
pub version: u64,
pub changes: Vec<DocumentTextChange>,
@@ -596,13 +602,19 @@ mod tests {
"document-changed".into(),
r#"{"path":"/p/a.rs","baseVersion":7,"version":8,"changes":[{"from":1,"to":2,"insert":"x"}]}"#.into(),
);
assert!(matches!(change, Event::DocumentChanged(DocumentChanged { base_version: 7, .. })));
assert!(matches!(change, Event::DocumentChanged(DocumentChanged { base_version: 7, project: None, .. })));
let change = Event::from_other(
"document-changed".into(),
r#"{"path":"a.rs","project":"/p","baseVersion":7,"version":8,"changes":[]}"#.into(),
);
assert!(matches!(change, Event::DocumentChanged(DocumentChanged { project: Some(ref p), .. }) if p == "/p"));
let ready = Event::from_other("websocket-ready".into(), r#"{"pluginId":"collab","connection":42}"#.into());
assert_eq!(ready, Event::WebSocketReady(WebSocketReady { plugin_id: "collab".into(), connection: 42 }));
let document = Document { version: 7, text: "a😀b".into() };
let change = DocumentChanged {
path: "/p/a.rs".into(),
project: None,
base_version: 7,
version: 8,
changes: vec![DocumentTextChange { from: 1, to: 3, insert: "x".into() }],
+5
Переглянути файл
@@ -5181,6 +5181,11 @@ export type DockerVolume = {
/** Local changes accepted by the editor's shared document model. */
export type DocumentChanged = {
path: string,
/**
* The open project `path` is relative to, set when the event is handed to a plugin
* (the editor posts the absolute path and `null`).
*/
project: string | null,
baseVersion: number,
version: number,
changes: DocumentTextChange[],
Loaded 100 of 101 files, more files were not shown because too many files have changed in this diff. Show more