Log the command flycheck runs to debug misconfigurations

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 (e.g. they have mutually-exclusive features.
Having the command rust-analyzer ran should help a lot
This commit is contained in:
Veetaha 2020-08-11 03:12:09 +03:00
parent b050937c10
commit 4f386afb16

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 {