Skip to content

Commit

Permalink
Auto merge of rust-lang#13088 - Veykril:flycheck-failure, r=Veykril
Browse files Browse the repository at this point in the history
Pop an error notification when flycheck can't be restarted
  • Loading branch information
bors committed Aug 22, 2022
2 parents fdc28b4 + 2abb78d commit 6711ded
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
10 changes: 6 additions & 4 deletions crates/flycheck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ pub enum Progress {
DidCheckCrate(String),
DidFinish(io::Result<()>),
DidCancel,
DidFailToRestart(String),
}

enum Restart {
Expand Down Expand Up @@ -193,10 +194,11 @@ impl FlycheckActor {
self.progress(Progress::DidStart);
}
Err(error) => {
tracing::error!(
command = ?self.check_command(),
%error, "failed to restart flycheck"
);
self.progress(Progress::DidFailToRestart(format!(
"Failed to run the following command: {:?} error={}",
self.check_command(),
error
)));
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions crates/rust-analyzer/src/main_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,13 @@ impl GlobalState {
}
flycheck::Progress::DidCheckCrate(target) => (Progress::Report, Some(target)),
flycheck::Progress::DidCancel => (Progress::End, None),
flycheck::Progress::DidFailToRestart(err) => {
self.show_and_log_error(
"cargo check failed".to_string(),
Some(err.to_string()),
);
return;
}
flycheck::Progress::DidFinish(result) => {
if let Err(err) = result {
self.show_and_log_error(
Expand Down

0 comments on commit 6711ded

Please sign in to comment.