From 76c1160ffa626fc5f07b309420e6666eb79a3311 Mon Sep 17 00:00:00 2001 From: veetaha Date: Sun, 10 May 2020 18:35:33 +0300 Subject: Migrate flycheck to fully-lsp-compatible progress reports (introduce ra_progress crate) --- crates/ra_ide/Cargo.toml | 1 + crates/ra_ide/src/lib.rs | 7 ++----- crates/ra_ide/src/prime_caches.rs | 9 ++------- 3 files changed, 5 insertions(+), 12 deletions(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/Cargo.toml b/crates/ra_ide/Cargo.toml index 05c940605..722652fb2 100644 --- a/crates/ra_ide/Cargo.toml +++ b/crates/ra_ide/Cargo.toml @@ -29,6 +29,7 @@ ra_fmt = { path = "../ra_fmt" } ra_prof = { path = "../ra_prof" } test_utils = { path = "../test_utils" } ra_assists = { path = "../ra_assists" } +ra_progress = { path = "../ra_progress" } # ra_ide should depend only on the top-level `hir` package. if you need # something from some `hir_xxx` subpackage, reexport the API via `hir`. diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 6704467d9..51dc1f041 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs @@ -241,11 +241,8 @@ impl Analysis { self.with_db(|db| status::status(&*db)) } - pub fn prime_caches

(&self, files: Vec, report_progress: P) -> Cancelable<()> - where - P: FnMut(usize) + std::panic::UnwindSafe, - { - self.with_db(|db| prime_caches::prime_caches(db, files, report_progress)) + pub fn prime_caches(&self, files: Vec) -> Cancelable<()> { + self.with_db(|db| prime_caches::prime_caches(db, files)) } /// 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 f60595989..c5ab5a1d8 100644 --- a/crates/ra_ide/src/prime_caches.rs +++ b/crates/ra_ide/src/prime_caches.rs @@ -5,13 +5,8 @@ use crate::{FileId, RootDatabase}; -pub(crate) fn prime_caches( - db: &RootDatabase, - files: Vec, - mut report_progress: impl FnMut(usize), -) { - for (i, file) in files.into_iter().enumerate() { +pub(crate) fn prime_caches(db: &RootDatabase, files: Vec) { + for file in files { let _ = crate::syntax_highlighting::highlight(db, file, None, false); - report_progress(i); } } -- cgit v1.2.3