From c1a31d4261afda9839020f772fd6a97a12d9c941 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Fri, 24 Apr 2020 23:30:49 -0400 Subject: main: eagerly prime goto-definition caches This commit makes RA more aggressive about eagerly priming the caches. In particular, this fixes an issue where even after RA was done priming its caches, an initial goto-definition request would have very high latency. This fixes that issue by requesting syntax highlighting for everything. It is presumed that this is a tad wasteful, but not overly so. This commit also tweaks the logic that determines when the cache is primed. Namely, instead of just priming it when the state is loaded initially, we attempt to prime it whenever some state changes. This fixes an issue where if a modification notification is seen before cache priming is done, it would stop the cache priming early. --- crates/ra_ide/src/prime_caches.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'crates/ra_ide/src') 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 @@ //! 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) { - let sema = Semantics::new(db); for file in files { - let _ = sema.to_module_def(file); + let _ = crate::syntax_highlighting::highlight(db, file, None); } } -- cgit v1.2.3