mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 13:48:50 +00:00
feat: improve CPU usage
closes #9922 Turned out to be trivial after preliminary refactor. The intended behavior is that we schedule cache priming once ws become quiescent (that is, we fully load cargo project), and we continue to rschedule it until it completes (priming might get cancelled by user typing into a file).
This commit is contained in:
parent
9e0203bd69
commit
53d2050085
1 changed files with 5 additions and 3 deletions
|
@ -296,12 +296,15 @@ impl GlobalState {
|
|||
));
|
||||
fraction = Progress::fraction(report.n_done, report.n_total);
|
||||
}
|
||||
PrimeCachesProgress::End { cancelled: _ } => {
|
||||
PrimeCachesProgress::End { cancelled } => {
|
||||
state = Progress::End;
|
||||
message = None;
|
||||
fraction = 1.0;
|
||||
|
||||
self.prime_caches_queue.op_completed(());
|
||||
if cancelled {
|
||||
self.prime_caches_queue.request_op();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -424,11 +427,10 @@ impl GlobalState {
|
|||
for flycheck in &self.flycheck {
|
||||
flycheck.update();
|
||||
}
|
||||
self.prime_caches_queue.request_op();
|
||||
}
|
||||
|
||||
if !was_quiescent || state_changed {
|
||||
self.prime_caches_queue.request_op();
|
||||
|
||||
// Refresh semantic tokens if the client supports it.
|
||||
if self.config.semantic_tokens_refresh() {
|
||||
self.semantic_tokens_cache.lock().clear();
|
||||
|
|
Loading…
Reference in a new issue