Description
(The way that I came across this issue was a confluence of weird BigCo constraints, the use of a virtualized file system, and me acting as a de-facto vendor for Rust Analyzer. I don't expect most people to encounter this in the first place.)
I've noticed a small inconsistency when working with config values that override commands: namely, the config value provided for rust-analyzer.server.path
will trim the leading ~
from the provided path, but the same will not occur for rust-analyzer.rustfmt.overrideCommand
(I assume the holds for every other overridable command in Rust Analyzer, but I haven't tested those other commands yet) . This means that I can't point every instance of Rust Analyzer used at my employer at the appropriate rustfmt
(or any other binary) inside of the monorepo, as providing the home directory-relative path to rustfmt
results in a textDocument/formatting failed. Message: Failed to spawn
error being shown.
If it's okay with y'all, I'd be happy to write a bit of code in the Rust Analyzer server itself to bring the existing behavior for rust-analyzer.server.path
to all other config values that accept paths. I don't think it'll cause any issues for people who don't have weird setups like my employer does, but it'll certainly reduce my support burden. If nothing else, it might remove an inconsistency.
Alternatives Considered
- Using
"${userHome}
instead of~/
. Unfortunately, variable interpolation is not supported inside of VS Code's settings (Support variables when resolving values in settings microsoft/vscode#2809). - Adding
rustfmt
to the $PATH by default. This is feels a bit hacky and can mess with people'srustup
-managed toolchain, so I'd rather avoid this if I can.