feat(lsp): default rust-analyzer to the full enrichment sweep#243
Merged
Conversation
The demand-gated sweep skips a file whose declarations are already statically resolved, on the premise that its call edges are recoverable without the language server. That holds for most languages, but Rust method calls bind overwhelmingly to standard-library receiver types the graph never indexes, so rust-analyzer's net-new call-hierarchy edges come from the sweep the demand gate skips — leaving recall on the table. Add a per-server DefaultSweepMode on ServerSpec, inserted into the sweep precedence between the operator config and the global demand default, and set it to full for rust-analyzer. Both operator sources still win, so GORTEX_LSP_SWEEP or semantic.lsp_sweep put rust-analyzer back on the demand gate; every other server is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a per-server
DefaultSweepModetoServerSpecand sets it tofullfor rust-analyzer, so Rust gets the full enrichment sweep out of the box while every other language keeps the demand-gated default.New sweep-mode precedence (highest first):
GORTEX_LSP_SWEEPenv →semantic.lsp_sweepconfig → per-server spec default → globaldemand. Both operator sources still win, sosemantic.lsp_sweep: demand(or the env) puts rust-analyzer back on the demand gate.Why
The demand gate skips a file whose declarations are already statically resolved, on the premise that its call edges are recoverable without the language server. That premise holds for Go / TS / Python but not Rust: measured on ripgrep, Rust's method calls bind overwhelmingly to standard-library receiver types (
Vec/String/Option/&[u8]) that the graph never indexes, so static resolution can't recover them and rust-analyzer's net-new call-hierarchy edges come precisely from the sweep the demand gate skips.Concretely, across a language matrix (baseline vs demand vs full):
fullis the better default.A separate investigation confirmed this gap is not closable by improving Gortex's native Rust resolution: the residual ambiguity is standard-library-shaped, which is inherently language-server territory. So defaulting rust-analyzer to
fullis the right lever.Tests
resolveSweepModeprecedence including the new spec-default level (env > config > spec default > demand); unrecognised spec default falls through.effectiveSweepMode: a specDefaultSweepModeis honoured, the router field and env both override it, and the real rust-analyzer registry spec resolves tofull.go build,go test -race ./internal/semantic/lsp/,golangci-lintall green.docs/lsp.mdupdated with the new precedence and rust-analyzer note.