aboutsummaryrefslogtreecommitdiff
path: root/crates/vfs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-02-12 16:45:58 +0000
committerGitHub <[email protected]>2021-02-12 16:45:58 +0000
commitcf44953210cbfe189043417690fabd0037a6e74e (patch)
tree357232094eb1bc5a98362fb6ec2d6d65160573be /crates/vfs
parent777d936c17631dfc32a37bd919e45597b83349e4 (diff)
parent8c196056d5d51b0c7395eab399f548fc38b9573b (diff)
Merge #7652
7652: Fix slow tests sometimes failing r=flodiebold a=flodiebold In some situations we reloaded the workspace in the tests after having reported to be ready. There's two fixes here: 1. Add a version to the VFS config and include that version in progress reports, so that we don't think we're done prematurely; 2. Delay status transitions until after changes are applied. Otherwise the last change during loading can potentially trigger a workspace reload, if it contains interesting changes. Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/vfs')
-rw-r--r--crates/vfs/src/loader.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/vfs/src/loader.rs b/crates/vfs/src/loader.rs
index d3bdae562..473b29fcb 100644
--- a/crates/vfs/src/loader.rs
+++ b/crates/vfs/src/loader.rs
@@ -32,6 +32,9 @@ pub struct Directories {
32/// [`Handle`]'s configuration. 32/// [`Handle`]'s configuration.
33#[derive(Debug)] 33#[derive(Debug)]
34pub struct Config { 34pub struct Config {
35 /// Version number to associate progress updates to the right config
36 /// version.
37 pub version: u32,
35 /// Set of initially loaded files. 38 /// Set of initially loaded files.
36 pub load: Vec<Entry>, 39 pub load: Vec<Entry>,
37 /// Index of watched entries in `load`. 40 /// Index of watched entries in `load`.
@@ -45,7 +48,7 @@ pub enum Message {
45 /// Indicate a gradual progress. 48 /// Indicate a gradual progress.
46 /// 49 ///
47 /// This is supposed to be the number of loaded files. 50 /// This is supposed to be the number of loaded files.
48 Progress { n_total: usize, n_done: usize }, 51 Progress { n_total: usize, n_done: usize, config_version: u32 },
49 /// The handle loaded the following files' content. 52 /// The handle loaded the following files' content.
50 Loaded { files: Vec<(AbsPathBuf, Option<Vec<u8>>)> }, 53 Loaded { files: Vec<(AbsPathBuf, Option<Vec<u8>>)> },
51} 54}
@@ -196,10 +199,11 @@ impl fmt::Debug for Message {
196 Message::Loaded { files } => { 199 Message::Loaded { files } => {
197 f.debug_struct("Loaded").field("n_files", &files.len()).finish() 200 f.debug_struct("Loaded").field("n_files", &files.len()).finish()
198 } 201 }
199 Message::Progress { n_total, n_done } => f 202 Message::Progress { n_total, n_done, config_version } => f
200 .debug_struct("Progress") 203 .debug_struct("Progress")
201 .field("n_total", n_total) 204 .field("n_total", n_total)
202 .field("n_done", n_done) 205 .field("n_done", n_done)
206 .field("config_version", config_version)
203 .finish(), 207 .finish(),
204 } 208 }
205 } 209 }