aboutsummaryrefslogtreecommitdiff
path: root/crates/flycheck/src
diff options
context:
space:
mode:
authorVeetaha <[email protected]>2020-08-11 01:12:09 +0100
committerVeetaha <[email protected]>2020-08-11 01:12:09 +0100
commit4f386afb16297f588484ff24e2b4693218893a94 (patch)
tree53828b0727e1fb77af2b97b9cf5131e390820c29 /crates/flycheck/src
parentb050937c1071e68a4ade69375f1f17b703cafb02 (diff)
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
Diffstat (limited to 'crates/flycheck/src')
-rw-r--r--crates/flycheck/src/lib.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/flycheck/src/lib.rs b/crates/flycheck/src/lib.rs
index 7c38f5ef9..31e14246d 100644
--- a/crates/flycheck/src/lib.rs
+++ b/crates/flycheck/src/lib.rs
@@ -1,4 +1,4 @@
1//! cargo_check provides the functionality needed to run `cargo check` or 1//! Flycheck provides the functionality needed to run `cargo check` or
2//! another compatible command (f.x. clippy) in a background thread and provide 2//! another compatible command (f.x. clippy) in a background thread and provide
3//! LSP diagnostics based on the output of the command. 3//! LSP diagnostics based on the output of the command.
4 4
@@ -147,6 +147,12 @@ impl FlycheckActor {
147 // avoid busy-waiting. 147 // avoid busy-waiting.
148 let cargo_handle = self.cargo_handle.take().unwrap(); 148 let cargo_handle = self.cargo_handle.take().unwrap();
149 let res = cargo_handle.join(); 149 let res = cargo_handle.join();
150 if res.is_err() {
151 log::error!(
152 "Flycheck failed to run the following command: {:?}",
153 self.check_command()
154 )
155 }
150 self.send(Message::Progress(Progress::DidFinish(res))); 156 self.send(Message::Progress(Progress::DidFinish(res)));
151 } 157 }
152 Event::CheckEvent(Some(message)) => match message { 158 Event::CheckEvent(Some(message)) => match message {
@@ -253,7 +259,7 @@ impl CargoHandle {
253 return Err(io::Error::new( 259 return Err(io::Error::new(
254 io::ErrorKind::Other, 260 io::ErrorKind::Other,
255 format!( 261 format!(
256 "Cargo watcher failed,the command produced no valid metadata (exit code: {:?})", 262 "Cargo watcher failed, the command produced no valid metadata (exit code: {:?})",
257 exit_status 263 exit_status
258 ), 264 ),
259 )); 265 ));