3

I set up the VS Code settings.json with the following configuration:

{
    "rust-analyzer.checkOnSave": true,
    "rust-analyzer.runnables.extraEnv": {
        "RUST_BACKTRACE": "0"
    },
    "rust-analyzer.cargo.targetDir": true,
    // "rust-analyzer.check.command": "clippy",
    "rust-analyzer.check.overrideCommand": [
        "cargo-clif",
        "check",
        "--workspace",
        "--message-format=json",
        "--all-targets"
    ]
}

This works, but when I run watchexec -- cargo-clif run on the project (it's a web server) to restart it on each change in the codebase, it stops with the following message:

Blocking waiting for file lock on build directory

If I use:

"rust-analyzer.check.command": "clippy",

it doesn't block.

How can I make cargo-clif check works in its own directory?

1 Answer 1

2

rust-analyzer does not support using a custom target directory when rust-analyzer.check.overrideCommand is used, however you can do it yourself. What rust-analyzer does when you set "rust-analyzer.cargo.targetDir": true is just passing --target-dir <old_target_dir>/rust-analyzer. You can just as well pass this argument manually to the command.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.