Hey, so, when I open rustc in rust-analyzer, I get a bunch of entries in the "problem" section that I think come from running
cargo check and not
x.py check -- is there a way to customize the command rust-analyzer uses? Also, is this written up? Should I RTFM?
@nikomatsakis eh, unfortunately, I guess we lack the docs for this one in the repo itself.
Actually, the best way to inspect what's available in the configs is by hitting
(the non-cool) method is using the vscode settings UI
x.py check means, I doubt that we will be able to watch that command, we are hardcoding the
cargo executable right now. Maybe we should generalize this more. The main concern is that the command that is watched has to produce
stdout output compatible with
cargo metadata protocol.
I know you are new vscode, just as a reminder, there is a global
settings.json file that you can assess via
Ctrl+Shift+P (command palette) and
Preferences: Open Settings (JSON).
But if you need project-specific overrides, just create
.vscode/settings.json in the root of the folder opened in vscode.
Right now I think the _workaround_ would be to create a cargo alias that runs this
x.py under the hood and then passing the alias name as
hmm, I see, I could make like
cargo build-rustc or something
and set rust-analyzer.cargo-watch command
that doesn't quite seem to work for me but .. not sure why
could be related to the errors I am getting around "watching" having problems because of needing more file descriptors or something
(specifically, I just get "no output" from the Problems section)
is there some way to see the "cargo watch" output?
Unfortunately, we don't log the output itself (due to the compexity around reading both
stderr simultaneously (i.e. this bit of your code)), but we log the command that is run if it ends with an error in
Rust Analyzer Language Server output.
that helps, thanks
[ERROR ra_cargo_watch] Cargo watcher failed CargoError("the command produced no valid metadata (exit code: ExitStatus(ExitStatus(256))): cargo build-rustc --workspace --message-format=json --manifest-path /home/nmatsakis/versioned/rust-3/Cargo.toml --all-targets")
I'll have to see if I can get the metadata output correct
is there a way to customize the command rust-analyzer uses?
Not, yet, we unfortunatelly at the moment only allow to override the name of the cargo command. I've wanted to add a hook to override everything for ages, started working on this today.