mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
drop Rust Analyzer Bazel rule
With proper excludes set up, starting it outside of Bazel is similarly fast, and unit tests work correctly. It also makes initial Bazel startup faster, as the Rust sources no longer need to be fetched.
This commit is contained in:
parent
bbddc79da4
commit
fc0035306c
4 changed files with 12 additions and 21 deletions
|
@ -1,5 +1,4 @@
|
||||||
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
|
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
|
||||||
load("@rules_rust//rust:defs.bzl", "rust_analyzer")
|
|
||||||
|
|
||||||
config_setting(
|
config_setting(
|
||||||
name = "release",
|
name = "release",
|
||||||
|
@ -40,10 +39,5 @@ pkg_tar(
|
||||||
tags = ["manual"],
|
tags = ["manual"],
|
||||||
)
|
)
|
||||||
|
|
||||||
rust_analyzer(
|
|
||||||
name = "rust_analyzer",
|
|
||||||
targets = ["//rslib:anki"],
|
|
||||||
)
|
|
||||||
|
|
||||||
# for version info
|
# for version info
|
||||||
exports_files(["defs.bzl"])
|
exports_files(["defs.bzl"])
|
||||||
|
|
2
defs.bzl
2
defs.bzl
|
@ -20,7 +20,7 @@ def setup_deps():
|
||||||
|
|
||||||
rust_repositories(
|
rust_repositories(
|
||||||
edition = "2018",
|
edition = "2018",
|
||||||
include_rustc_srcs = True,
|
include_rustc_srcs = False,
|
||||||
)
|
)
|
||||||
|
|
||||||
raze_fetch_remote_crates()
|
raze_fetch_remote_crates()
|
||||||
|
|
|
@ -173,15 +173,19 @@ CPU usage, but Pylance doesn't do a great job understanding the type annotations
|
||||||
|
|
||||||
## Rust editing
|
## Rust editing
|
||||||
|
|
||||||
Rust editor support is still fairly new, but currently Visual Studio Code + Rust
|
Currently Visual Studio Code + Rust Analyzer seems to be the best option out
|
||||||
Analyzer seems to be the least-bad option. Once Rust Analyzer is installed,
|
there. Once Rust Analyzer is installed, you'll want to enable the options to
|
||||||
you'll want to enable the options to expand proc macros, and run cargo check on
|
expand proc macros and build scripts, and run cargo check on startup. Adding
|
||||||
startup.
|
`+nightly` as an extra arg to rustfmt will get you nicer automatic formatting
|
||||||
|
of `use` statements.
|
||||||
|
|
||||||
After running 'code rslib' from the project root, it may take Rust Analyzer a
|
The Bazel build products will make RA start up slowly out of the box. For a much
|
||||||
while to become ready - if you check the running processes on your machine you should
|
nicer experience, add each of the bazel-* folders to Rust Analyzer's excludeDirs
|
||||||
see it running in the background for a while.
|
settings, and ts/node_modules. Wildcards don't work unfortunately. Then adjust
|
||||||
|
VS Code's "watcher exclude", and add `**/bazel-*`.
|
||||||
|
|
||||||
|
After running 'code' from the project root, it may take a minute or two to be
|
||||||
|
ready.
|
||||||
## TypeScript editing
|
## TypeScript editing
|
||||||
|
|
||||||
Visual Studio Code seems to give the best experience. Use 'code ts' from the project
|
Visual Studio Code seems to give the best experience. Use 'code ts' from the project
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
bazel run @rules_rust//tools/rust_analyzer:gen_rust_project
|
|
||||||
code .
|
|
||||||
|
|
Loading…
Reference in a new issue