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.
This commit is contained in:
Florian Diebold
2021-02-12 15:58:29 +01:00
parent dee5aba43a
commit a7387cae2c
6 changed files with 51 additions and 14 deletions

View File

@@ -59,7 +59,11 @@ pub fn load_cargo(root: &Path, config: &LoadCargoConfig) -> Result<(AnalysisHost
);
let project_folders = ProjectFolders::new(&[ws], &[], build_data.as_ref());
loader.set_config(vfs::loader::Config { load: project_folders.load, watch: vec![] });
loader.set_config(vfs::loader::Config {
load: project_folders.load,
watch: vec![],
version: 0,
});
log::debug!("crate graph: {:?}", crate_graph);
let host = load(crate_graph, project_folders.source_root_config, &mut vfs, &receiver);
@@ -79,7 +83,7 @@ fn load(
// wait until Vfs has loaded all roots
for task in receiver {
match task {
vfs::loader::Message::Progress { n_done, n_total } => {
vfs::loader::Message::Progress { n_done, n_total, config_version: _ } => {
if n_done == n_total {
break;
}