From a7387cae2ca9d5e114246e6fada98bfe7808e1d0 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 12 Feb 2021 15:58:29 +0100 Subject: 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. --- crates/vfs/src/loader.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'crates/vfs') 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 { /// [`Handle`]'s configuration. #[derive(Debug)] pub struct Config { + /// Version number to associate progress updates to the right config + /// version. + pub version: u32, /// Set of initially loaded files. pub load: Vec, /// Index of watched entries in `load`. @@ -45,7 +48,7 @@ pub enum Message { /// Indicate a gradual progress. /// /// This is supposed to be the number of loaded files. - Progress { n_total: usize, n_done: usize }, + Progress { n_total: usize, n_done: usize, config_version: u32 }, /// The handle loaded the following files' content. Loaded { files: Vec<(AbsPathBuf, Option>)> }, } @@ -196,10 +199,11 @@ impl fmt::Debug for Message { Message::Loaded { files } => { f.debug_struct("Loaded").field("n_files", &files.len()).finish() } - Message::Progress { n_total, n_done } => f + Message::Progress { n_total, n_done, config_version } => f .debug_struct("Progress") .field("n_total", n_total) .field("n_done", n_done) + .field("config_version", config_version) .finish(), } } -- cgit v1.2.3