Skip to main content

Lazy loading and resource management

Nothing heavy starts until a user action needs it, and nothing stays alive longer than a documented policy allows.

Language services​

A service is shared by every compatible document while it runs; "idle" means it has no documents. Failure to start covers a missing binary, an initialisation error and the 60 s initialisation timeout.

  1. Opening a folder starts no language server.
  2. Opening a document identifies its language and parses it (syntax is available at once).
  3. A server starts only for a trusted folder, a file inside it, and a server the profile allows.
  4. One service runs per (workspace root, server id); every compatible document shares it. Ten Rust tabs use one rust-analyzer.
  5. A TypeScript document cannot start rust-analyzer; different languages use different services.
  6. When a service has no documents, it keeps running for the profile's idle_grace_seconds (30 s generic, 300 s rust) so quick close/reopen does not restart it. Then it receives shutdown/exit.
  7. max_running_services is a soft cap: when reached, the longest-idle service is stopped first. Services with open documents are never stopped to satisfy the cap.
  8. Text buffers belong to the core. Stopping, crashing or restarting a service never touches unsaved text; on restart, open documents are re-sent with their current contents.

These policies come from the active profile. Tests in crates/ide-languages/tests/lsp_lifecycle.rs cover sharing, grace-period reuse, eviction, missing servers, crash restarts and restart limits.

Syntax analysis limits​

Measurements showed that a Tree-sitter tree uses about 40 bytes per source byte and that re-parsing very large flat files can take tens of milliseconds (see performance). So:

LimitValueEffect
Syntax size limit1 MiBLarger files open as plain text; the status bar says why.
Keystroke reparse budget6 msA slower reparse is stopped; the previous tree (shifted by the edit) keeps highlighting usable.
Deferred reparsenext frame without inputHighlighting catches up as soon as typing pauses.
Open-time parse budget500 msPathological input cannot freeze the window.

Lifting the 1 MiB limit requires background or viewport-limited parsing; it is on the backlog.

Other bounded resources​

ResourceBound
ExplorerOne directory per expansion; 5 000 entries per directory shown.
Documents64 MiB per file; undo history 10 000 steps.
DecorationsVisible lines only; 2 000 per provider; lines over 4 096 chars skipped.
RenderingVisible lines only; 10 000 chars per line drawn.
Server stderrLast 40 lines.
AI context16 000 chars of selection.
Extensions256 per directory, 256 KiB manifests, 64 contributions per kind.

Measuring​

The status bar shows PSS (or RSS) of the IDE plus all child processes on Linux. axiom-perf and axiom --perf-idle-memory report the same per process; see benchmarking.