-
Notifications
You must be signed in to change notification settings - Fork 482
rust-analyzer via bazel documentation #2799
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
Comments
I don't think that According to the rust-analyzer docs, both
For As for which output groups we need for each command, I'm also not sure. |
Sorry for the slow reply.
I think you are right, this was written some time ago and I have since discovered that the build script command was useless. As mentioned above, I think what I wrote works okay, my main issue is just that checks interfere with my usual build-cache. I have been told that this should not be too hard to fix, but I haven't really had time to look into it. Other than that, my main comment in this issue was that I think there are (were?) typos in the docs, since the output groups I saw in the code didn't match the docs, and it would in general be nice with better docs for setting up something like a |
Related: #1649 |
I thought that the "cargo check"-like functionality described here worked before, but it seems like it doesn't anymore. I just get errors like this:
This makes sense, because without first resolving symlinks these are not files within the editor's workspace. Maybe rust-analyzer has stopped resolving symlinks here? |
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: