diff options
author | Jonas Schievink <[email protected]> | 2020-09-17 17:50:30 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2020-09-27 18:41:54 +0100 |
commit | 1a28f30ba48254fae30a29c2f1053f653d5e687e (patch) | |
tree | 66fb358443e69ad81bd9a5331b205891a7d5acfc /crates/rust-analyzer/src/main_loop.rs | |
parent | 662ed41ebcb1cd221b32be95d08b5bf5f10ae525 (diff) |
Spawn a flycheck instance per workspace
Diffstat (limited to 'crates/rust-analyzer/src/main_loop.rs')
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 8d3132581..06ab9d508 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -266,8 +266,8 @@ impl GlobalState { | |||
266 | } | 266 | } |
267 | } | 267 | } |
268 | 268 | ||
269 | flycheck::Message::Progress(status) => { | 269 | flycheck::Message::Progress { id, progress } => { |
270 | let (state, message) = match status { | 270 | let (state, message) = match progress { |
271 | flycheck::Progress::DidStart => { | 271 | flycheck::Progress::DidStart => { |
272 | self.diagnostics.clear_check(); | 272 | self.diagnostics.clear_check(); |
273 | (Progress::Begin, None) | 273 | (Progress::Begin, None) |
@@ -284,14 +284,21 @@ impl GlobalState { | |||
284 | } | 284 | } |
285 | }; | 285 | }; |
286 | 286 | ||
287 | self.report_progress("cargo check", state, message, None); | 287 | // When we're running multiple flychecks, we have to include a disambiguator in |
288 | // the title, or the editor complains. Note that this is a user-facing string. | ||
289 | let title = if self.flycheck.len() == 1 { | ||
290 | "cargo check".to_string() | ||
291 | } else { | ||
292 | format!("cargo check (#{})", id + 1) | ||
293 | }; | ||
294 | self.report_progress(&title, state, message, None); | ||
288 | } | 295 | } |
289 | }, | 296 | }, |
290 | } | 297 | } |
291 | 298 | ||
292 | let state_changed = self.process_changes(); | 299 | let state_changed = self.process_changes(); |
293 | if prev_status == Status::Loading && self.status == Status::Ready { | 300 | if prev_status == Status::Loading && self.status == Status::Ready { |
294 | if let Some(flycheck) = &self.flycheck { | 301 | for flycheck in &self.flycheck { |
295 | flycheck.update(); | 302 | flycheck.update(); |
296 | } | 303 | } |
297 | } | 304 | } |
@@ -490,7 +497,7 @@ impl GlobalState { | |||
490 | Ok(()) | 497 | Ok(()) |
491 | })? | 498 | })? |
492 | .on::<lsp_types::notification::DidSaveTextDocument>(|this, params| { | 499 | .on::<lsp_types::notification::DidSaveTextDocument>(|this, params| { |
493 | if let Some(flycheck) = &this.flycheck { | 500 | for flycheck in &this.flycheck { |
494 | flycheck.update(); | 501 | flycheck.update(); |
495 | } | 502 | } |
496 | if let Ok(abs_path) = from_proto::abs_path(¶ms.text_document.uri) { | 503 | if let Ok(abs_path) = from_proto::abs_path(¶ms.text_document.uri) { |