diff options
author | Florian Diebold <[email protected]> | 2021-02-12 14:58:29 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-02-12 15:31:16 +0000 |
commit | a7387cae2ca9d5e114246e6fada98bfe7808e1d0 (patch) | |
tree | db0fe8d939afaa10929debf317be670f79909c9f /crates/vfs/src | |
parent | dee5aba43a1b45131bf31268431fa71923f2ef2a (diff) |
Fix slow tests sometimes failing
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.
Diffstat (limited to 'crates/vfs/src')
-rw-r--r-- | crates/vfs/src/loader.rs | 8 |
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)] |
34 | pub struct Config { | 34 | pub 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 | } |