Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode extension: custom "check" using cargo alias is not fully implemented #8098

Closed
jmaargh opened this issue Mar 18, 2021 · 6 comments
Closed
Labels
S-actionable Someone could pick this issue up and work on it right now

Comments

@jmaargh
Copy link

jmaargh commented Mar 18, 2021

Cargo has a neat aliasing feature which can use one of the two syntaxes in the .cargo/config.toml file (or equivalent):

[alias]
c1 = "clippy"
c2 = ["clippy", "--", "-W", "clippy::pedantic"]

Both of these work as expected in the terminal, but only c1 works when you set it as "rust-analyzer.checkOnSave.command": "c1" in vscode. With c2 I get the following in the extension logs (RA_LOG=warn):

[ERROR flycheck] Flycheck failed to run the following command: "cargo" "c2" "--workspace" "--message-format=json" "--manifest-path" "/home/john-mark/code/Rust/emugb/Cargo.toml" "--all-targets"
[ERROR rust_analyzer::main_loop] cargo check failed: Cargo watcher failed, the command produced no valid metadata (exit code: ExitStatus(ExitStatus(25856)))
@Veykril Veykril added S-actionable Someone could pick this issue up and work on it right now S-unactionable Issue requires feedback, design decisions or is blocked on other work and removed S-actionable Someone could pick this issue up and work on it right now S-unactionable Issue requires feedback, design decisions or is blocked on other work labels Mar 18, 2021
@jonas-schievink
Copy link
Contributor

I think this is working as expected. For commands that are not CLI-compatible with cargo check, you can set rust-analyzer.checkOnSave.overrideCommand instead.

@jmaargh
Copy link
Author

jmaargh commented Mar 18, 2021

That's a bit of a pain. I was hoping to have a single source-of-truth for preferred clippy flags, and I obviously don't want to have --message-format=json when running in the terminal.

@jmaargh
Copy link
Author

jmaargh commented Mar 18, 2021

As an aside, it would be lovely if malformed checkOnSave.commands didn't just silently fail: no error popup, not even a log message until I re-started with an environment variable set.

@lnicola
Copy link
Member

lnicola commented Mar 19, 2021

I was hoping to have a single source-of-truth for preferred clippy flags

That's clippy.toml, right?

@jmaargh
Copy link
Author

jmaargh commented Mar 24, 2021

@lnicola I think it should, but the clippy people apparently disagree: rust-lang/rust-clippy#1313

@Veykril
Copy link
Member

Veykril commented May 27, 2022

We now show an error pop up and proper information, otherwise this works as intended.

@Veykril Veykril closed this as completed May 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

No branches or pull requests

4 participants