rust-analyzer: lightweight profile (disable cachePriming + cargo.autoreload)

serena's symbol tools (find_symbol, find_referencing_symbols, …) only need the
symbol index, but the LSP is launched with VS Code's full heavyweight defaults.
On a large, actively-built Rust workspace these drove rust-analyzer to 40+ GB
RSS and triggered a full re-index on every external `cargo build` (target/
churn). Disabling the two eager/auto re-indexing drivers keeps symbol
navigation working at a fraction of the memory:

- cachePriming.enable: True -> False  (no eager whole-workspace+deps index)
- cargo.autoreload:    True -> False  (no re-index storm on target/ changes)

checkOnSave is intentionally LEFT enabled: serena's get_diagnostics_for_file
relies on flycheck (`cargo check`) for Rust diagnostics, and disabling it makes
that tool return empty (test/solidlsp/rust/test_rust_diagnostics.py fails with
[]). checkOnSave only spawns transient `cargo check` child processes and is not
a driver of rust-analyzer's resident RSS, so keeping it on preserves
diagnostics at no meaningful memory cost.

Observed on a rustback (multi-crate + rustic_core fork) workspace: repeated
40-44 GB rust-analyzer processes under serena with no VS Code present. Suggest
upstream expose a "lightweight"/symbol-only RA profile or a config toggle.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit e09b9b623e321f72e64b6ba3de6708ff519f524f)
This commit is contained in:
davidcforbes authored and Tyce Herrman committed 2026-07-29 09:45:48 -04:00
1 parent a61765ecc8
commit 3be211c662
1 file changed
+12 -2
+12 -2
View File
@@ -505,9 +505,19 @@ class RustAnalyzer(SolidLanguageServer):
"showUnlinkedFileNotification": True,
"showDependenciesExplorer": True,
"assist": {"emitMustUse": False, "expressionFillDefault": "todo"},
"cachePriming": {"enable": True, "numThreads": 0},
# rustback lightweight patch: serena's symbol tools don't need
# rust-analyzer's eager whole-workspace+deps cache priming, nor a
# re-index on every cargo metadata / target/ change. On large,
# actively-built Rust workspaces these drove rust-analyzer to
# 40+ GB RSS and re-indexed on every external `cargo build`.
# Disabling them keeps symbol navigation working at a fraction of
# the memory. NOTE: checkOnSave is intentionally left enabled below
# because serena's get_diagnostics_for_file relies on flycheck
# (`cargo check`) for Rust diagnostics. (Upstream: expose these as
# a config knob / a "lightweight" RA profile.)
"cachePriming": {"enable": False, "numThreads": 0},
"cargo": {
"autoreload": True,
"autoreload": False,
"buildScripts": {
"enable": True,
"invocationLocation": "workspace",