Setting cargo command to fetch metadata in rust-analyzer in VSCode?

Hi, I need to dynamically set proxy variables before calling Cargo, so I created a wrapper around cargo to do that. I'm trying to make VSCode use that wrapper. Found and set these relevant settings:

    "rust-analyzer.runnables.command": "cargowrap",
    "rust-analyzer.cargo.buildScripts.overrideCommand": ["cargowrap check --quiet --workspace --message-format=json --all-targets"],
    "rust-analyzer.check.overrideCommand": ["cargowrap check --workspace --message-format=json --all-targets"]

But it's not enough, VSCode still runs regular cargo when it's trying to fetch metadata. Is there a VSCode setting I missed perhaps?

Thanks.

Sorry for not addressing your actual question, but is the Cargo http.proxy setting (and friends) adequate for your use case?

They're not, because proxy vars need to be set dynamically. Corp environment requires hopping between different vpns.

1 Like