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
Adds a target that can be used for project auto-discovery by using the
`discoverConfig` settings as described in the `rust-analyzer` user
manual.
Unlike the `gen_rust_project` target, this can be used for dynamic
project discovery, and passing `{arg}` to `discoverConfig.command` can
split big repositories into multiple, smaller workspaces that
`rust-analyzer` switches between as needed. Large repositories can make
it OOM.
At amo, we've used a similar implementation for a while with great
success, which is why we figured we might upstream it. The changes also
include two additional output groups to ensure that proc-macros and
build script targets are built, as `rust-analyzer` depends on these to
provide complete IDE support.
Additionally, the PR makes use of the `output_base` value in `bazel`
invocations. We found it helpful to have tools such as `rust-analyzer`
and `clippy` run on a separate bazel server than the one used for
building. And a `config_group` argument was added to provide the ability
to provide a config group to `bazel` invocations.
An attempt to get codelens actions to work was done as well,
particularly around tests and binaries. They seem to work, but I'm not
100% sure whether the approach taken is the right one.
Closes#2755 .
---------
Co-authored-by: Krasimir Georgiev <[email protected]>
Then you can use a prototype [rust-analyzer plugin](https://marketplace.visualstudio.com/items?itemName=MattStark.bazel-rust-analyzer) that automatically collects the outputs whenever you recompile.
86
88
87
-
]]#
89
+
## Project auto-discovery
90
+
### Setup
91
+
92
+
Auto-discovery makes `rust-analyzer` behave in a Bazel project in a similar fashion to how it does
93
+
in a Cargo project. This is achieved by generating a structure similar to what `rust-project.json`
94
+
contains but, instead of writing that to a file, the data gets piped to `rust-analyzer` directly
95
+
through `stdout`. To use auto-discovery the `rust-analyzer` IDE settings must be configured similar to:
0 commit comments