diff options
author | Aleksey Kladov <[email protected]> | 2021-04-06 11:23:09 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-04-06 11:23:09 +0100 |
commit | 9143e3925cd95d30af72745f25e185f65a686d32 (patch) | |
tree | 701fd1902cce7792bf52b51772eadc44f4f8b673 /crates/rust-analyzer/src/global_state.rs | |
parent | e3c47ccefca2069da70a9513bc2b7f6fbd0f894c (diff) |
Prepare for more stateless status reporting
Diffstat (limited to 'crates/rust-analyzer/src/global_state.rs')
-rw-r--r-- | crates/rust-analyzer/src/global_state.rs | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs index b9be1e7b8..44a656e62 100644 --- a/crates/rust-analyzer/src/global_state.rs +++ b/crates/rust-analyzer/src/global_state.rs | |||
@@ -67,21 +67,25 @@ pub(crate) struct GlobalState { | |||
67 | req_queue: ReqQueue, | 67 | req_queue: ReqQueue, |
68 | pub(crate) task_pool: Handle<TaskPool<Task>, Receiver<Task>>, | 68 | pub(crate) task_pool: Handle<TaskPool<Task>, Receiver<Task>>, |
69 | pub(crate) loader: Handle<Box<dyn vfs::loader::Handle>, Receiver<vfs::loader::Message>>, | 69 | pub(crate) loader: Handle<Box<dyn vfs::loader::Handle>, Receiver<vfs::loader::Message>>, |
70 | pub(crate) vfs_config_version: u32, | ||
71 | pub(crate) flycheck: Vec<FlycheckHandle>, | ||
72 | pub(crate) flycheck_sender: Sender<flycheck::Message>, | ||
73 | pub(crate) flycheck_receiver: Receiver<flycheck::Message>, | ||
74 | pub(crate) config: Arc<Config>, | 70 | pub(crate) config: Arc<Config>, |
75 | pub(crate) analysis_host: AnalysisHost, | 71 | pub(crate) analysis_host: AnalysisHost, |
76 | pub(crate) diagnostics: DiagnosticCollection, | 72 | pub(crate) diagnostics: DiagnosticCollection, |
77 | pub(crate) mem_docs: FxHashMap<VfsPath, DocumentData>, | 73 | pub(crate) mem_docs: FxHashMap<VfsPath, DocumentData>, |
78 | pub(crate) semantic_tokens_cache: Arc<Mutex<FxHashMap<Url, SemanticTokens>>>, | 74 | pub(crate) semantic_tokens_cache: Arc<Mutex<FxHashMap<Url, SemanticTokens>>>, |
79 | pub(crate) vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>, | ||
80 | pub(crate) shutdown_requested: bool, | 75 | pub(crate) shutdown_requested: bool, |
81 | pub(crate) status: Status, | 76 | pub(crate) status: Status, |
82 | pub(crate) source_root_config: SourceRootConfig, | 77 | pub(crate) source_root_config: SourceRootConfig, |
83 | pub(crate) proc_macro_client: Option<ProcMacroClient>, | 78 | pub(crate) proc_macro_client: Option<ProcMacroClient>, |
84 | 79 | ||
80 | pub(crate) flycheck: Vec<FlycheckHandle>, | ||
81 | pub(crate) flycheck_sender: Sender<flycheck::Message>, | ||
82 | pub(crate) flycheck_receiver: Receiver<flycheck::Message>, | ||
83 | |||
84 | pub(crate) vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>, | ||
85 | pub(crate) vfs_config_version: u32, | ||
86 | pub(crate) vfs_progress_n_total: usize, | ||
87 | pub(crate) vfs_progress_n_done: usize, | ||
88 | |||
85 | /// For both `workspaces` and `workspace_build_data`, the field stores the | 89 | /// For both `workspaces` and `workspace_build_data`, the field stores the |
86 | /// data we actually use, while the `OpQueue` stores the result of the last | 90 | /// data we actually use, while the `OpQueue` stores the result of the last |
87 | /// fetch. | 91 | /// fetch. |
@@ -129,23 +133,27 @@ impl GlobalState { | |||
129 | GlobalState { | 133 | GlobalState { |
130 | sender, | 134 | sender, |
131 | req_queue: ReqQueue::default(), | 135 | req_queue: ReqQueue::default(), |
132 | vfs_config_version: 0, | ||
133 | task_pool, | 136 | task_pool, |
134 | loader, | 137 | loader, |
135 | flycheck: Vec::new(), | ||
136 | flycheck_sender, | ||
137 | flycheck_receiver, | ||
138 | config: Arc::new(config), | 138 | config: Arc::new(config), |
139 | analysis_host, | 139 | analysis_host, |
140 | diagnostics: Default::default(), | 140 | diagnostics: Default::default(), |
141 | mem_docs: FxHashMap::default(), | 141 | mem_docs: FxHashMap::default(), |
142 | semantic_tokens_cache: Arc::new(Default::default()), | 142 | semantic_tokens_cache: Arc::new(Default::default()), |
143 | vfs: Arc::new(RwLock::new((vfs::Vfs::default(), FxHashMap::default()))), | ||
144 | shutdown_requested: false, | 143 | shutdown_requested: false, |
145 | status: Status::default(), | 144 | status: Status::default(), |
146 | source_root_config: SourceRootConfig::default(), | 145 | source_root_config: SourceRootConfig::default(), |
147 | proc_macro_client: None, | 146 | proc_macro_client: None, |
148 | 147 | ||
148 | flycheck: Vec::new(), | ||
149 | flycheck_sender, | ||
150 | flycheck_receiver, | ||
151 | |||
152 | vfs: Arc::new(RwLock::new((vfs::Vfs::default(), FxHashMap::default()))), | ||
153 | vfs_config_version: 0, | ||
154 | vfs_progress_n_total: 0, | ||
155 | vfs_progress_n_done: 0, | ||
156 | |||
149 | workspaces: Arc::new(Vec::new()), | 157 | workspaces: Arc::new(Vec::new()), |
150 | fetch_workspaces_queue: OpQueue::default(), | 158 | fetch_workspaces_queue: OpQueue::default(), |
151 | workspace_build_data: None, | 159 | workspace_build_data: None, |