diff options
author | Edwin Cheng <[email protected]> | 2021-01-07 17:08:46 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2021-01-07 17:18:58 +0000 |
commit | 2b2d699b35d69375def80fe51c6a8c3bfbe53828 (patch) | |
tree | 1c10b2986017fc1e756d2bce75250546cce9310b /crates/rust-analyzer/src/main_loop.rs | |
parent | 54eb87de0363cfba1d7104b8d37898fc120c029b (diff) |
Report progress for cargo metadata and output-dir
Diffstat (limited to 'crates/rust-analyzer/src/main_loop.rs')
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 7ac6acf70..22ee96775 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -22,6 +22,7 @@ use crate::{ | |||
22 | global_state::{file_id_to_url, url_to_file_id, GlobalState, Status}, | 22 | global_state::{file_id_to_url, url_to_file_id, GlobalState, Status}, |
23 | handlers, lsp_ext, | 23 | handlers, lsp_ext, |
24 | lsp_utils::{apply_document_changes, is_canceled, notification_is, Progress}, | 24 | lsp_utils::{apply_document_changes, is_canceled, notification_is, Progress}, |
25 | reload::ProjectWorkspaceProgress, | ||
25 | Result, | 26 | Result, |
26 | }; | 27 | }; |
27 | 28 | ||
@@ -63,6 +64,7 @@ pub(crate) enum Task { | |||
63 | Diagnostics(Vec<(FileId, Vec<lsp_types::Diagnostic>)>), | 64 | Diagnostics(Vec<(FileId, Vec<lsp_types::Diagnostic>)>), |
64 | Workspaces(Vec<anyhow::Result<ProjectWorkspace>>), | 65 | Workspaces(Vec<anyhow::Result<ProjectWorkspace>>), |
65 | PrimeCaches(PrimeCachesProgress), | 66 | PrimeCaches(PrimeCachesProgress), |
67 | FetchWorkspace(ProjectWorkspaceProgress), | ||
66 | } | 68 | } |
67 | 69 | ||
68 | impl fmt::Debug for Event { | 70 | impl fmt::Debug for Event { |
@@ -216,6 +218,16 @@ impl GlobalState { | |||
216 | } | 218 | } |
217 | PrimeCachesProgress::Finished => prime_caches_progress.push(progress), | 219 | PrimeCachesProgress::Finished => prime_caches_progress.push(progress), |
218 | }, | 220 | }, |
221 | Task::FetchWorkspace(progress) => { | ||
222 | let (state, msg) = match progress { | ||
223 | ProjectWorkspaceProgress::Begin => (Progress::Begin, None), | ||
224 | ProjectWorkspaceProgress::Report(msg) => { | ||
225 | (Progress::Report, Some(msg)) | ||
226 | } | ||
227 | ProjectWorkspaceProgress::End => (Progress::End, None), | ||
228 | }; | ||
229 | self.report_progress("fetching", state, msg, None); | ||
230 | } | ||
219 | } | 231 | } |
220 | // Coalesce multiple task events into one loop turn | 232 | // Coalesce multiple task events into one loop turn |
221 | task = match self.task_pool.receiver.try_recv() { | 233 | task = match self.task_pool.receiver.try_recv() { |