5705: Log the command flycheck runs to debug misconfigurations r=jonas-schievink a=Veetaha

Without this users have no clue why flycheck fails to run.
This is what is printed to the output channel:
```
[ERROR rust_analyzer::main_loop] cargo check failed: Cargo watcher failed,the command produced no valid metadata (exit code: ExitStatus(ExitStatus(25856)))
```

I stumbled with this figuring out that rust-analyzer adds `--all-features` which is not intended
for some crates in the workspace (i.e. they have mutually-exclusive features).
Having the command rust-analyzer ran should help a lot

Co-authored-by: Veetaha <veetaha2@gmail.com>
This commit is contained in:
bors[bot] 2020-08-11 10:15:46 +00:00 committed by GitHub
commit 61ee051455
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
//! cargo_check provides the functionality needed to run `cargo check` or //! Flycheck provides the functionality needed to run `cargo check` or
//! another compatible command (f.x. clippy) in a background thread and provide //! another compatible command (f.x. clippy) in a background thread and provide
//! LSP diagnostics based on the output of the command. //! LSP diagnostics based on the output of the command.
@ -147,6 +147,12 @@ impl FlycheckActor {
// avoid busy-waiting. // avoid busy-waiting.
let cargo_handle = self.cargo_handle.take().unwrap(); let cargo_handle = self.cargo_handle.take().unwrap();
let res = cargo_handle.join(); let res = cargo_handle.join();
if res.is_err() {
log::error!(
"Flycheck failed to run the following command: {:?}",
self.check_command()
)
}
self.send(Message::Progress(Progress::DidFinish(res))); self.send(Message::Progress(Progress::DidFinish(res)));
} }
Event::CheckEvent(Some(message)) => match message { Event::CheckEvent(Some(message)) => match message {
@ -253,7 +259,7 @@ impl CargoHandle {
return Err(io::Error::new( return Err(io::Error::new(
io::ErrorKind::Other, io::ErrorKind::Other,
format!( format!(
"Cargo watcher failed,the command produced no valid metadata (exit code: {:?})", "Cargo watcher failed, the command produced no valid metadata (exit code: {:?})",
exit_status exit_status
), ),
)); ));