zed
zed copied to clipboard
Rust-Analyzer does not support "OverrideCommand"
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
👋
Not sure if it's a feature request or a bug, since RA/vscode supports it.
Given the following .zed/settings.json
, it seems that we can not override check
command.
Here is an example.
{
"lsp": {
"rust-analyzer": {
"initialization_options": {
"check": {
"overrideCommand": [
"sh",
"-c",
"cargo clippy --message-format=json --manifest-path ./a/Cargo.toml; cargo clippy --message-format=json --manifest-path ./b/Cargo.toml"
]
}
}
}
}
}
Environment
Zed: v0.131.4 (Zed Preview) OS: macOS 14.3.1 Memory: 64 GiB Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your ~/Library/Logs/Zed/Zed.log
file to this issue.
No response
Hey, that's pretty odd. I use overrideCommand
myself and it does work for me;
My config for RA
"lsp": {
"rust-analyzer": {
"initialization_options": {
"check": {
"allTargets": false,
"overrideCommand": ["cargo", "build", "--message-format=json"]
}
}
}
}
It isn't working for me either. These are my settings:
{
"lsp": {
"rust-analyzer": {
"initialization_options": {
"check": {
"overrideCommand": [
"cargo",
"check",
"--target=arm-unknown-linux-musleabihf" // "--target=x86_64-apple-darwin"
]
}
}
}
}
}
In the terminal running cargo check --target=arm-unknown-linux-musleabihf
works. Same with cargo check --target=x86_64-apple-darwin
Edit: actually, I see in ~/Library/Logs/Zed/Zed.log that the command is being executed correctly because I see the error I'm expecting. It's just that I don't see the error in the UI. And also it still shows me this diagnostic, which shouldn't show up if I'm targeting arm-unknown-linux-musleabihf
Edit 2: in my case, the issue was that I was missing "--message-format=json"
in my command. Working command is:
{
"lsp": {
"rust-analyzer": {
"initialization_options": {
"check": {
"overrideCommand": [
"cargo",
"check",
"--target=arm-unknown-linux-musleabihf",
"--message-format=json"
]