New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom rustfmt
commands cannot use relative executable paths
#4486
Comments
Curiously, relative paths do work for |
I assume it's because |
According to the doc, But why do we need to set |
Not sure there's a super-grand design here, but we do want rustfmt to pick up rustfmt.toml. Hm, is tihs right at all though? Like if I run Separately, I feel that semantics of relative paths in config should be independent of the cwd of the language server. |
@ecstatic-morse Can you test this again? The (Marking |
I now set the rustfmt command to |
Is it the expected behavior that this vs code setting should not work? {
"rust-analyzer.rustfmt.extraArgs": [
"--config-path",
"./config",
]
} If so, what is the workaround for a file in {
"rust-analyzer.rustfmt.extraArgs": [
"--config-path",
"C:/Users/Example/Project/config",
]
} |
While trying to make
rust-analyzer
use the bootstrap version ofrustfmt
insiderustc
, @jonas-schievink discovered that using a relative path torustfmt
won't work:https://github.com/rust-analyzer/rust-analyzer/blob/d51c1f62178c383363a2d95e865131d9a7b969d0/crates/rust-analyzer/src/main_loop/handlers.rs#L651-L655
As a workaround, you can specify an absolute path, but I was thinking we could canonicalize the first "shell word" if it looks like a path (e.g.,
./rustfmt
orbuild/rustfmt
but notrustfmt2
). This would require some sort of library that can do shell word-splitting, however. Perhaps there is a better way?The
which
crate would be helpful for part of this.The text was updated successfully, but these errors were encountered: