HeadlinesBriefing favicon HeadlinesBriefing.com

Rust Glancer: Low-Memory LSP Server for Rust

Hacker News •
×

Rust Glancer, a functional LSP server for Rust, uses two orders of magnitude less RAM than rust-analyzer. The author critiques rust-analyzer's reliance on rowan for syntax trees and suggests that for the 99% use case—analyzing 6666 dependencies you never edit—a simple list of arrays would suffice. Incremental parsing and DOM-mutation refactorings are only needed for the actively edited 1%.

Proc macros remain a major memory hog: expanding them runs real code, generates massive output, and contributes ~30% of rust-analyzer's binary size via JSON parsing. A lazy, non‑incremental approach for function bodies—indexing only items and analyzing the current file—could blend the best of both worlds. Comparison with Rust Rover (minus GUI) suggests similar compactness, though build‑script and proc‑macro support may stay limited.

The ideal architecture mirrors IntelliJ's PSI: a concrete syntax tree for open files, a compact on‑disk stub tree for project files, and pre‑compiled .rmeta files for dependencies. rust‑analyzer should switch to salsa only when the user touches ~/.cargo/registry/src. Defining an abstract API for Rust code access—supporting rmeta inputs—remains the lowest‑hanging watermelon for a true "glance analyzer."