From 4f386afb16297f588484ff24e2b4693218893a94 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 11 Aug 2020 03:12:09 +0300 Subject: 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 --- crates/flycheck/src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'crates/flycheck') 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 @@ -//! 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 //! LSP diagnostics based on the output of the command. @@ -147,6 +147,12 @@ impl FlycheckActor { // avoid busy-waiting. let cargo_handle = self.cargo_handle.take().unwrap(); 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))); } Event::CheckEvent(Some(message)) => match message { @@ -253,7 +259,7 @@ impl CargoHandle { return Err(io::Error::new( io::ErrorKind::Other, 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 ), )); -- cgit v1.2.3 From 8d34262956059aca7e6fded351a9299b3581a5cf Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 12 Aug 2020 16:52:28 +0200 Subject: Rename ra_toolchain -> toolchain --- crates/flycheck/Cargo.toml | 2 +- crates/flycheck/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/flycheck') diff --git a/crates/flycheck/Cargo.toml b/crates/flycheck/Cargo.toml index ff8a1e568..acc72bc59 100644 --- a/crates/flycheck/Cargo.toml +++ b/crates/flycheck/Cargo.toml @@ -14,4 +14,4 @@ log = "0.4.8" cargo_metadata = "0.11.1" serde_json = "1.0.48" jod-thread = "0.1.1" -ra_toolchain = { path = "../ra_toolchain" } +toolchain = { path = "../toolchain" } diff --git a/crates/flycheck/src/lib.rs b/crates/flycheck/src/lib.rs index 31e14246d..16078d104 100644 --- a/crates/flycheck/src/lib.rs +++ b/crates/flycheck/src/lib.rs @@ -193,7 +193,7 @@ impl FlycheckActor { extra_args, features, } => { - let mut cmd = Command::new(ra_toolchain::cargo()); + let mut cmd = Command::new(toolchain::cargo()); cmd.arg(command); cmd.args(&["--workspace", "--message-format=json", "--manifest-path"]) .arg(self.workspace_root.join("Cargo.toml")); -- cgit v1.2.3 From 1b0c7701cc97cd7bef8bb9729011d4cf291a60c5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 13 Aug 2020 17:42:52 +0200 Subject: Rename ra_ide -> ide --- crates/flycheck/Cargo.toml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'crates/flycheck') diff --git a/crates/flycheck/Cargo.toml b/crates/flycheck/Cargo.toml index acc72bc59..262a66e4e 100644 --- a/crates/flycheck/Cargo.toml +++ b/crates/flycheck/Cargo.toml @@ -1,9 +1,9 @@ [package] -edition = "2018" name = "flycheck" -version = "0.1.0" -authors = ["rust-analyzer developers"] +version = "0.0.0" license = "MIT OR Apache-2.0" +authors = ["rust-analyzer developers"] +edition = "2018" [lib] doctest = false @@ -14,4 +14,5 @@ log = "0.4.8" cargo_metadata = "0.11.1" serde_json = "1.0.48" jod-thread = "0.1.1" + toolchain = { path = "../toolchain" } -- cgit v1.2.3