-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
flycheck: rustc
diagnostics are not read properly
#14217
Comments
This has been brought up in #13437, so you might want to follow the discussion there. |
Thanks for the suggestion @lnicola . It looks like #13437 addresses the first issue I ran into, the one about the overrideCommand not being given the current file as an argument, but not the second part. That is, even when I give it an explicit file to compile and output rustc's message as json, it does not work. Is rustc's output not correct? I guess I'm asking what the structure of the json that r-a requires is. Or is there another reason this isn't working? |
Confirmed. The issue is around here.
It works if you set: {
"rust-analyzer.check.overrideCommand": [
"sh",
"-c",
"rustc --error-format=json src/main.rs 2>&1"
]
} |
rustc
diagnostics are not read properly
Ah, yes, redirecting output from |
In the User Manual there is a section on setting up rust-analyzer for non-cargo based projects. I very much appreciate that this is something RA offers, and I've gotten it working more or less with the rust-project.json file in my project root, at least in terms of basic LSP functionality.
However, I can't seem to get the compile errors working, and I find these just too useful to not ask about them. I'm aware that normally this is done with
cargo check
, which is disabled by the presence of rust-project.json, but the documentation suggests that there is a way to replacecargo check
with something else, as long as the output is a form of json. My thinking is to use arustc
based command in its place. Basically something like this:rustc --error-format=json -o /dev/null
I've hacked up my LSP client (vim-lsc) to provide this command to rust-analyzer via the initializationOptions on start up. And I've verified through gdb that its getting to rust-analyzer and that rust-analyzer is indeed running this command when I save my file, but it always returns a "cargo check failed" repsonse. I've inverstigated this a bit and have found the following:
rustc --error-format=json -o /dev/null <path-to-my-file>
. With this, I can see I'm getting output fromrustc
in the RA logs. But, I'm still getting the "cargo check failed" response.Here is what I think is a relevant snippet from RA's error logs:
The rest is just more output from
rustc
. Not sure what the flycheck error means.So at this point I'm basically stuck. I don't know if the output of
rustc
is just not correct, or if there is something else I need to do. Any help on this would be greatly appreciated.The text was updated successfully, but these errors were encountered: