You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a rust-analyzer setup that seems to work okay with rules_rust and bazel now, but I am not that used to using bazel/rules_rust yet, so I would like to ask if what I do makes sense or if there is a better way.
I thought this might fit better in Discussions, but decided to make it an issue, since I think the problem is common enough that there should be better documentation. I.e., this issue is really asking for more documentation on setting up rust-analyzer with rules_rust. (I have seen http://bazelbuild.github.io/rules_rust/rust_analyzer.html, but think it would be better to write more about the rust-analyzer setup directly, so it covers more than just VSCode. Also, there seems to be a few typos in the docs - see the NOTE later.)
What I have done is to put something like the following in my .bazelrc:
on top of using rust_register_toolchains in my WORKSPACE file. (Also there is an alias for gen_rust_project.)
NOTE: I use rustc_output_diagnostics, rustc_rmeta_output and rustc_output but the docs say output_diagnostics, rust_lib_rustc_output and rust_metadata_rustc_output.
(So if nothing else, I think this part of the docs needs an update.)
when in my bazel directory and just the standard setup otherwise. I am not sure how to set it up per directory in other editors, but I think the VSCode setup should just be something like:
My question is now if this kind of setup makes sense? Am I doing something weird in the buildScripts override?
Also, is there an easy way to not have my rust-analyzer builds interfere with my usual build cache (because of the change of flags)? It would be nice to have it behave even more like cargo check although my current setup works okay.
Either way, I think slightly better documentation for setting up rust-analyzer would be good.
The text was updated successfully, but these errors were encountered:
I have a rust-analyzer setup that seems to work okay with rules_rust and bazel now, but I am not that used to using bazel/rules_rust yet, so I would like to ask if what I do makes sense or if there is a better way.
I thought this might fit better in
Discussions
, but decided to make it an issue, since I think the problem is common enough that there should be better documentation. I.e., this issue is really asking for more documentation on setting up rust-analyzer with rules_rust. (I have seen http://bazelbuild.github.io/rules_rust/rust_analyzer.html, but think it would be better to write more about the rust-analyzer setup directly, so it covers more than just VSCode. Also, there seems to be a few typos in the docs - see the NOTE later.)What I have done is to put something like the following in my
.bazelrc
:on top of using
rust_register_toolchains
in myWORKSPACE
file. (Also there is an alias forgen_rust_project
.)NOTE: I use
rustc_output_diagnostics
,rustc_rmeta_output
andrustc_output
but the docs sayoutput_diagnostics
,rust_lib_rustc_output
andrust_metadata_rustc_output
.(So if nothing else, I think this part of the docs needs an update.)
Then in neovim I have a setup like
which tells rust-analyzer to use
and
when in my bazel directory and just the standard setup otherwise. I am not sure how to set it up per directory in other editors, but I think the VSCode setup should just be something like:
My question is now if this kind of setup makes sense? Am I doing something weird in the buildScripts override?
Also, is there an easy way to not have my rust-analyzer builds interfere with my usual build cache (because of the change of flags)? It would be nice to have it behave even more like
cargo check
although my current setup works okay.Either way, I think slightly better documentation for setting up rust-analyzer would be good.
The text was updated successfully, but these errors were encountered: