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

checkOnSave.overrideCommand fails after updating vscode #10735

Closed
Mirko-von-Leipzig opened this issue Nov 10, 2021 · 7 comments
Closed

checkOnSave.overrideCommand fails after updating vscode #10735

Mirko-von-Leipzig opened this issue Nov 10, 2021 · 7 comments

Comments

@Mirko-von-Leipzig
Copy link

Mirko-von-Leipzig commented Nov 10, 2021

This was working fine yesterday, but is now failing (only known change is updating vscode this morning -- after which it started failing).

The pop-up message: cargo check failed: No such file or directory (os error 2)
and Rust-Analyzer Language Server output: [ERROR flycheck] Flycheck failed to run the following command: "cargo" "clippy" "--message-format=json" "--" "--allow=dead-code".

RA version

rust-analyzer version: 2c0f433fd 2021-11-08 stable

vscode version (I am using WSL 2.0)

Version: 1.62.1 (user setup)
Commit: f4af3cbf5a99787542e2a30fe1fd37cd644cc31f
Date: 2021-11-05T10:57:55.946Z
Electron: 13.5.2
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.22000

My command:

    "rust-analyzer.checkOnSave.overrideCommand": [
        "cargo",
        "clippy",
        "--message-format=json",
        "--",
        "--allow=dead-code"
    ]
@bjorn3
Copy link
Member

bjorn3 commented Nov 10, 2021

Does it work of you run cargo clippy --message-format=json -- --allow=dead-code yourself?

@Mirko-von-Leipzig
Copy link
Author

Mirko-von-Leipzig commented Nov 10, 2021

Does it work of you run cargo clippy --message-format=json -- --allow=dead-code yourself?

Yes, it dumps a bunch of json artifacts:

{"reason":"compiler-artifact","package_id":"thiserror 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)","manifest_path":"/home/mirko/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/thiserror-1.0.29/Cargo.toml","target":{"kind":["lib"],"crate_types":["lib"],"name":"thiserror","src_path":"/home/mirko/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/thiserror-1.0.29/src/lib.rs","edition":"2018","doc":true,"doctest":true,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/mirko/projects/starknet/target/debug/deps/libthiserror-d6f1b9e767a3a0c5.rlib","/home/mirko/projects/starknet/target/debug/deps/libthiserror-d6f1b9e767a3a0c5.rmeta"],"executable":null,"fresh":true}
...
...
{"reason":"build-finished","success":true}

@lnicola
Copy link
Member

lnicola commented Nov 10, 2021

Is that using the Remote WSL extension? You might need to configure the PATH variable on the remote side.

@Mirko-von-Leipzig
Copy link
Author

Is that using the Remote WSL extension? You might need to configure the PATH variable on the remote side.

Yes, using WSL extension. What needs configuring? (and why did it work before?).

@lnicola
Copy link
Member

lnicola commented Nov 10, 2021

Maybe remoteEnv / PATH as described in https://code.visualstudio.com/remote/advancedcontainers/environment-variables, making sure that $HOME/.cargo/bin is included in PATH.

But I don't know, I've never tried it.

@Mirko-von-Leipzig
Copy link
Author

Maybe remoteEnv / PATH as described in https://code.visualstudio.com/remote/advancedcontainers/environment-variables, making sure that $HOME/.cargo/bin is included in PATH.

But I don't know, I've never tried it.

Thanks, but I don't think those apply since I'm not using a container. The overrideCommand is specified in the local WSL folder (i.e. $HOME/project/.vscode/settings.json). $HOME/.cargo/bin is included in path.

@Mirko-von-Leipzig
Copy link
Author

I am happy to report that the latest VSCode update (1.62.2) has resolved this issue.

From the list of fixes, I would guess that its this issue that was the culprit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants