diff --git a/BUILD.bazel b/BUILD.bazel index d85cc6356..f97f95162 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,5 +1,4 @@ load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") -load("@rules_rust//rust:defs.bzl", "rust_analyzer") config_setting( name = "release", @@ -40,10 +39,5 @@ pkg_tar( tags = ["manual"], ) -rust_analyzer( - name = "rust_analyzer", - targets = ["//rslib:anki"], -) - # for version info exports_files(["defs.bzl"]) diff --git a/defs.bzl b/defs.bzl index f65f0b02a..d12635177 100644 --- a/defs.bzl +++ b/defs.bzl @@ -20,7 +20,7 @@ def setup_deps(): rust_repositories( edition = "2018", - include_rustc_srcs = True, + include_rustc_srcs = False, ) raze_fetch_remote_crates() diff --git a/docs/development.md b/docs/development.md index f9247906e..1a9671e84 100644 --- a/docs/development.md +++ b/docs/development.md @@ -173,15 +173,19 @@ CPU usage, but Pylance doesn't do a great job understanding the type annotations ## Rust editing -Rust editor support is still fairly new, but currently Visual Studio Code + Rust -Analyzer seems to be the least-bad option. Once Rust Analyzer is installed, -you'll want to enable the options to expand proc macros, and run cargo check on -startup. +Currently Visual Studio Code + Rust Analyzer seems to be the best option out +there. Once Rust Analyzer is installed, you'll want to enable the options to +expand proc macros and build scripts, and run cargo check on startup. Adding +`+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 -while to become ready - if you check the running processes on your machine you should -see it running in the background for a while. +The Bazel build products will make RA start up slowly out of the box. For a much +nicer experience, add each of the bazel-* folders to Rust Analyzer's excludeDirs +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 Visual Studio Code seems to give the best experience. Use 'code ts' from the project diff --git a/scripts/vscode-rust b/scripts/vscode-rust deleted file mode 100755 index 72423a132..000000000 --- a/scripts/vscode-rust +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -set -e - -bazel run @rules_rust//tools/rust_analyzer:gen_rust_project -code . -