mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-05 01:38:47 +00:00
c1a31d4261
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.
12 lines
506 B
Rust
12 lines
506 B
Rust
//! rust-analyzer is lazy and doesn't not compute anything unless asked. This
|
|
//! sometimes is counter productive when, for example, the first goto definition
|
|
//! request takes longer to compute. This modules implemented prepopulating of
|
|
//! various caches, it's not really advanced at the moment.
|
|
|
|
use crate::{FileId, RootDatabase};
|
|
|
|
pub(crate) fn prime_caches(db: &RootDatabase, files: Vec<FileId>) {
|
|
for file in files {
|
|
let _ = crate::syntax_highlighting::highlight(db, file, None);
|
|
}
|
|
}
|