Rust-analywer (mac) and docker (linux)

i have vs code in my mac where i edit the project and used a volume to docker image where the project is run, i think rust-analywer doing build for mac and docker image doing build for linux thas make a miss where i forced to clean and remove target each time i want to run in docker image

You can force rust-analyzer to use a different directory within target/ using this vscode config:

    "rust-analyzer.server.extraEnv": {
        "CARGO_PROFILE_RUST_ANALYZER_INHERITS": "dev",
        "CARGO_TARGET_DIR": "target/analyzer"
    },

You may need to reload vscode for this to take effect.

1 Like