diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_ide/src/prime_caches.rs | 5 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 16 |
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 628c989bf..90bf7d25f 100644 --- a/crates/ra_ide/src/prime_caches.rs +++ b/crates/ra_ide/src/prime_caches.rs | |||
@@ -3,13 +3,10 @@ | |||
3 | //! request takes longer to compute. This modules implemented prepopulating of | 3 | //! request takes longer to compute. This modules implemented prepopulating of |
4 | //! various caches, it's not really advanced at the moment. | 4 | //! various caches, it's not really advanced at the moment. |
5 | 5 | ||
6 | use hir::Semantics; | ||
7 | |||
8 | use crate::{FileId, RootDatabase}; | 6 | use crate::{FileId, RootDatabase}; |
9 | 7 | ||
10 | pub(crate) fn prime_caches(db: &RootDatabase, files: Vec<FileId>) { | 8 | pub(crate) fn prime_caches(db: &RootDatabase, files: Vec<FileId>) { |
11 | let sema = Semantics::new(db); | ||
12 | for file in files { | 9 | for file in files { |
13 | let _ = sema.to_module_def(file); | 10 | let _ = crate::syntax_highlighting::highlight(db, file, None); |
14 | } | 11 | } |
15 | } | 12 | } |
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index d993c4146..f3aef3f0f 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) | |||
222 | libdata_receiver.into_iter().for_each(drop); | 222 | libdata_receiver.into_iter().for_each(drop); |
223 | log::info!("...tasks have finished"); | 223 | log::info!("...tasks have finished"); |
224 | log::info!("joining threadpool..."); | 224 | log::info!("joining threadpool..."); |
225 | pool.join(); | ||
225 | drop(pool); | 226 | drop(pool); |
226 | log::info!("...threadpool has finished"); | 227 | log::info!("...threadpool has finished"); |
227 | 228 | ||
@@ -417,28 +418,29 @@ fn loop_turn( | |||
417 | && loop_state.pending_libraries.is_empty() | 418 | && loop_state.pending_libraries.is_empty() |
418 | && loop_state.in_flight_libraries == 0 | 419 | && loop_state.in_flight_libraries == 0 |
419 | { | 420 | { |
421 | state_changed = true; | ||
420 | loop_state.workspace_loaded = true; | 422 | loop_state.workspace_loaded = true; |
421 | if let Some(flycheck) = &world_state.flycheck { | 423 | if let Some(flycheck) = &world_state.flycheck { |
422 | flycheck.update(); | 424 | flycheck.update(); |
423 | } | 425 | } |
424 | pool.execute({ | ||
425 | let subs = loop_state.subscriptions.subscriptions(); | ||
426 | let snap = world_state.snapshot(); | ||
427 | move || snap.analysis().prime_caches(subs).unwrap_or_else(|_: Canceled| ()) | ||
428 | }); | ||
429 | } | 426 | } |
430 | 427 | ||
431 | if show_progress { | 428 | if show_progress { |
432 | send_startup_progress(&connection.sender, loop_state); | 429 | send_startup_progress(&connection.sender, loop_state); |
433 | } | 430 | } |
434 | 431 | ||
435 | if state_changed { | 432 | if state_changed && loop_state.workspace_loaded { |
436 | update_file_notifications_on_threadpool( | 433 | update_file_notifications_on_threadpool( |
437 | pool, | 434 | pool, |
438 | world_state.snapshot(), | 435 | world_state.snapshot(), |
439 | task_sender.clone(), | 436 | task_sender.clone(), |
440 | loop_state.subscriptions.subscriptions(), | 437 | loop_state.subscriptions.subscriptions(), |
441 | ) | 438 | ); |
439 | pool.execute({ | ||
440 | let subs = loop_state.subscriptions.subscriptions(); | ||
441 | let snap = world_state.snapshot(); | ||
442 | move || snap.analysis().prime_caches(subs).unwrap_or_else(|_: Canceled| ()) | ||
443 | }); | ||
442 | } | 444 | } |
443 | 445 | ||
444 | let loop_duration = loop_start.elapsed(); | 446 | let loop_duration = loop_start.elapsed(); |