diff options
Diffstat (limited to 'crates/ra_ide/src/prime_caches.rs')
-rw-r--r-- | crates/ra_ide/src/prime_caches.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/ra_ide/src/prime_caches.rs b/crates/ra_ide/src/prime_caches.rs new file mode 100644 index 000000000..628c989bf --- /dev/null +++ b/crates/ra_ide/src/prime_caches.rs | |||
@@ -0,0 +1,15 @@ | |||
1 | //! rust-analyzer is lazy and doesn't not compute anything unless asked. This | ||
2 | //! sometimes is counter productive when, for example, the first goto definition | ||
3 | //! request takes longer to compute. This modules implemented prepopulating of | ||
4 | //! various caches, it's not really advanced at the moment. | ||
5 | |||
6 | use hir::Semantics; | ||
7 | |||
8 | use crate::{FileId, RootDatabase}; | ||
9 | |||
10 | pub(crate) fn prime_caches(db: &RootDatabase, files: Vec<FileId>) { | ||
11 | let sema = Semantics::new(db); | ||
12 | for file in files { | ||
13 | let _ = sema.to_module_def(file); | ||
14 | } | ||
15 | } | ||