about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_ide/src/prime_caches.rs5
-rw-r--r--crates/rust-analyzer/src/main_loop.rs16
2 files changed, 10 insertions, 11 deletions
diff --git a/crates/ra_ide/src/prime_caches.rs b/crates/ra_ide/src/prime_caches.rs
index 628c989bfc3..90bf7d25f20 100644
--- a/crates/ra_ide/src/prime_caches.rs
+++ b/crates/ra_ide/src/prime_caches.rs
@@ -3,13 +3,10 @@
 //! request takes longer to compute. This modules implemented prepopulating of
 //! various caches, it's not really advanced at the moment.
 
-use hir::Semantics;
-
 use crate::{FileId, RootDatabase};
 
 pub(crate) fn prime_caches(db: &RootDatabase, files: Vec<FileId>) {
-    let sema = Semantics::new(db);
     for file in files {
-        let _ = sema.to_module_def(file);
+        let _ = crate::syntax_highlighting::highlight(db, file, None);
     }
 }
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index d993c414689..f3aef3f0f29 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -222,6 +222,7 @@ pub fn main_loop(ws_roots: Vec<PathBuf>, config: Config, connection: Connection)
     libdata_receiver.into_iter().for_each(drop);
     log::info!("...tasks have finished");
     log::info!("joining threadpool...");
+    pool.join();
     drop(pool);
     log::info!("...threadpool has finished");
 
@@ -417,28 +418,29 @@ fn loop_turn(
         && loop_state.pending_libraries.is_empty()
         && loop_state.in_flight_libraries == 0
     {
+        state_changed = true;
         loop_state.workspace_loaded = true;
         if let Some(flycheck) = &world_state.flycheck {
             flycheck.update();
         }
-        pool.execute({
-            let subs = loop_state.subscriptions.subscriptions();
-            let snap = world_state.snapshot();
-            move || snap.analysis().prime_caches(subs).unwrap_or_else(|_: Canceled| ())
-        });
     }
 
     if show_progress {
         send_startup_progress(&connection.sender, loop_state);
     }
 
-    if state_changed {
+    if state_changed && loop_state.workspace_loaded {
         update_file_notifications_on_threadpool(
             pool,
             world_state.snapshot(),
             task_sender.clone(),
             loop_state.subscriptions.subscriptions(),
-        )
+        );
+        pool.execute({
+            let subs = loop_state.subscriptions.subscriptions();
+            let snap = world_state.snapshot();
+            move || snap.analysis().prime_caches(subs).unwrap_or_else(|_: Canceled| ())
+        });
     }
 
     let loop_duration = loop_start.elapsed();