diff options
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index eec6676e0..ae364f862 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -2,6 +2,7 @@ | |||
2 | //! requests/replies and notifications back to the client. | 2 | //! requests/replies and notifications back to the client. |
3 | use std::{ | 3 | use std::{ |
4 | env, fmt, | 4 | env, fmt, |
5 | sync::Arc, | ||
5 | time::{Duration, Instant}, | 6 | time::{Duration, Instant}, |
6 | }; | 7 | }; |
7 | 8 | ||
@@ -229,17 +230,23 @@ impl GlobalState { | |||
229 | } | 230 | } |
230 | ProjectWorkspaceProgress::End(workspaces) => { | 231 | ProjectWorkspaceProgress::End(workspaces) => { |
231 | self.fetch_workspaces_completed(workspaces); | 232 | self.fetch_workspaces_completed(workspaces); |
233 | |||
234 | let old = Arc::clone(&self.workspaces); | ||
232 | self.switch_workspaces(); | 235 | self.switch_workspaces(); |
233 | if self.config.run_build_scripts() { | 236 | let workspaces_updated = !Arc::ptr_eq(&old, &self.workspaces); |
237 | |||
238 | if self.config.run_build_scripts() && workspaces_updated { | ||
234 | let mut collector = BuildDataCollector::default(); | 239 | let mut collector = BuildDataCollector::default(); |
235 | for ws in self.workspaces.iter() { | 240 | for ws in self.workspaces.iter() { |
236 | ws.collect_build_data_configs(&mut collector); | 241 | ws.collect_build_data_configs(&mut collector); |
237 | } | 242 | } |
238 | self.fetch_build_data_request(collector) | 243 | self.fetch_build_data_request(collector) |
239 | } | 244 | } |
245 | |||
240 | (Progress::End, None) | 246 | (Progress::End, None) |
241 | } | 247 | } |
242 | }; | 248 | }; |
249 | |||
243 | self.report_progress("fetching", state, msg, None); | 250 | self.report_progress("fetching", state, msg, None); |
244 | } | 251 | } |
245 | Task::FetchBuildData(progress) => { | 252 | Task::FetchBuildData(progress) => { |
@@ -250,15 +257,19 @@ impl GlobalState { | |||
250 | } | 257 | } |
251 | BuildDataProgress::End(build_data_result) => { | 258 | BuildDataProgress::End(build_data_result) => { |
252 | self.fetch_build_data_completed(build_data_result); | 259 | self.fetch_build_data_completed(build_data_result); |
260 | |||
253 | self.switch_workspaces(); | 261 | self.switch_workspaces(); |
262 | |||
254 | (Some(Progress::End), None) | 263 | (Some(Progress::End), None) |
255 | } | 264 | } |
256 | }; | 265 | }; |
266 | |||
257 | if let Some(state) = state { | 267 | if let Some(state) = state { |
258 | self.report_progress("loading", state, msg, None); | 268 | self.report_progress("loading", state, msg, None); |
259 | } | 269 | } |
260 | } | 270 | } |
261 | } | 271 | } |
272 | |||
262 | // Coalesce multiple task events into one loop turn | 273 | // Coalesce multiple task events into one loop turn |
263 | task = match self.task_pool.receiver.try_recv() { | 274 | task = match self.task_pool.receiver.try_recv() { |
264 | Ok(task) => task, | 275 | Ok(task) => task, |