diff options
author | veetaha <[email protected]> | 2020-05-10 04:44:02 +0100 |
---|---|---|
committer | Veetaha <[email protected]> | 2020-06-18 12:50:17 +0100 |
commit | 2f8126fcace3c5e7db01c755b91eb45a9c632cfd (patch) | |
tree | 1908ce82c4ef5229e81ecbaeff8ea4f1a0ef7bb6 /crates/ra_ide/src | |
parent | 0262dba97ef114bd7664a4e32be21caef2d63f0a (diff) |
Migrate flycheck to fully-lsp-compatible progress reports (introduce ra_progress crate)
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/lib.rs | 7 | ||||
-rw-r--r-- | crates/ra_ide/src/prime_caches.rs | 9 |
2 files changed, 12 insertions, 4 deletions
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 51dc1f041..6704467d9 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs | |||
@@ -241,8 +241,11 @@ impl Analysis { | |||
241 | self.with_db(|db| status::status(&*db)) | 241 | self.with_db(|db| status::status(&*db)) |
242 | } | 242 | } |
243 | 243 | ||
244 | pub fn prime_caches(&self, files: Vec<FileId>) -> Cancelable<()> { | 244 | pub fn prime_caches<P>(&self, files: Vec<FileId>, report_progress: P) -> Cancelable<()> |
245 | self.with_db(|db| prime_caches::prime_caches(db, files)) | 245 | where |
246 | P: FnMut(usize) + std::panic::UnwindSafe, | ||
247 | { | ||
248 | self.with_db(|db| prime_caches::prime_caches(db, files, report_progress)) | ||
246 | } | 249 | } |
247 | 250 | ||
248 | /// Gets the text of the source file. | 251 | /// Gets the text of the source file. |
diff --git a/crates/ra_ide/src/prime_caches.rs b/crates/ra_ide/src/prime_caches.rs index c5ab5a1d8..f60595989 100644 --- a/crates/ra_ide/src/prime_caches.rs +++ b/crates/ra_ide/src/prime_caches.rs | |||
@@ -5,8 +5,13 @@ | |||
5 | 5 | ||
6 | use crate::{FileId, RootDatabase}; | 6 | use crate::{FileId, RootDatabase}; |
7 | 7 | ||
8 | pub(crate) fn prime_caches(db: &RootDatabase, files: Vec<FileId>) { | 8 | pub(crate) fn prime_caches( |
9 | for file in files { | 9 | db: &RootDatabase, |
10 | files: Vec<FileId>, | ||
11 | mut report_progress: impl FnMut(usize), | ||
12 | ) { | ||
13 | for (i, file) in files.into_iter().enumerate() { | ||
10 | let _ = crate::syntax_highlighting::highlight(db, file, None, false); | 14 | let _ = crate::syntax_highlighting::highlight(db, file, None, false); |
15 | report_progress(i); | ||
11 | } | 16 | } |
12 | } | 17 | } |