Hi,
I run in Vscode with rust analyzer.
I really like the inlay buttons to run debug or interpret above the functions and would like to keep using them.
The way I organize my work:
Root:
--- cargo_artifacts
--- project1
--- src/
--- project2
--- src/
Now, my current configuration is to have a common cargo artifact folder. But I would like to have my final output binaries in release and debug folders inside the corresponding output dir for each project.
Root:
--- cargo_artifacts
--- project1
--- src/
--- output/
--- release/
--- project1 final binaries and so on
--- debug/
--- project1 final binaries and so on
--- project2
--- src/
--- output/
--- release/
--- project2 final binaries and so on
--- debug/
--- project2 final binaries and so on
I currently use an alias
alias cargob="cargo build -Z unstable-options --artifact-dir='output'"
part of my settings.json:
"rust-analyzer.runnables.extraTestBinaryArgs": [
"--show-output",
"--nocapture"
],
"rust-analyzer.runnables.extraArgs": [
"--release"
],
The difference with the default behavior is that each folder doesn't have the intermediate artifacts. Just the clean result (binary and lib).
The questions:
- Is there a way to setup the rust analyzer so that when I click "Run Test", it launches the release version in the corresponding output dir?
- Is there a way to setup the rust analyzer so that when I click "Debug", it launches the debug version in the corresponding output dir?
Both because when your binary needs some files, it is easier in the code to have them close to it. And when sending this binary on a remote server, you don't have to modify the paths in the code later on. Ease of life.
And you don't have to search in the common cargo_artifacts folder your binaries.
Everything local and clean.
Thanks