Expand description
Backend abstraction for LSP-style code intelligence.
Two backings implement this trait:
A) LspClient (stdio rust-analyzer) — CI/headless fallback, see client.rs
B) JetBrainsHttpBackend (in-IDE PSI over HTTP) — preferred, see jetbrains_backend.rs
The 5 mandatory methods exist in both backings (today’s behavior must not break). The default-degrading methods return a clear “unsupported” error unless a backing (Backing B) overrides them.
Structs§
- Conflict
- A refactoring conflict surfaced by
RenameProcessor.preprocessUsages(name collision, visibility loss, override clash).rangeis optional — some conflicts are scope-level, not tied to a single offset. - Edit
Result - Outcome of applying a
RangeEdit. - Inline
Apply - Phase-2
inlinerequest. NOforcefield — inline conflicts are partly non-overridable (spec §5.2, Entscheidung 4); the Rust gate is final. - Inline
Query - Phase-1
inlinerequest: resolved source span.keep_definitionmaps to the IntelliJ inline processors’ “inline all and keep declaration” flag (spec §3, Befund 2). The trait never sees aname_path— exactly like move/safe_delete. - Inspection
Diag - A single inspection/diagnostic result.
- Inspection
Info - A single available inspection (the
listmode of the inspections action). - Move
Apply - Phase-2
moverequest: the query plus theforceflag (Rust already gated plan_hash + conflicts before this is built). - Move
Query - Phase-1
moverequest: the resolved source span plus an already-resolved, already-jailed target (the trait never resolves aname_pathor a path). - Range
Edit - A resolved, ready-to-apply edit. The
name_path→ range resolution has already happened inctx_refactor; the backend only ever sees an absolute path + range. - Reformat
Query - Single-Phase
reformatrequest (spec §5.3): no usages, no plan_hash. - Reformat
Result - Outcome of
reformat: which files changed (Single-File in practice). A dedicated type makes “reformat has no usage concept” explicit in the type system (spec §5.4 Empfehlung). - Rename
Apply - Apply request: same target addressing as
RenameQueryplus theforceflag (passed through toRenameProcessor; Rust has already gated conflicts). - Rename
Plan - Outcome of
rename_preview: every usage + every conflict. Theplan_hashis built in Rust from this (seectx_refactor::plan_hash), never here. - Rename
Query - Query for
rename_preview: the target symbol is already resolved (name_path → range) inctx_refactor; the backend only ever sees an absolute + relative path and a range, exactly likeRangeEdit(noname_pathon the wire). - Rename
Result - Outcome of
rename_apply: which files the IDE actually changed (no per-file bodies — Multi-File would be too large; Rust re-reads via mtime validation). - Safe
Delete Apply - Phase-2
safe_deleterequest:force= Serena’sdeleteEvenIfUsed,propagate= delete now-unreferenced dependencies too. - Safe
Delete Query - Phase-1
safe_deleterequest: just the resolved source span.*_previewreturns the remaining (blocking) usages in the reusedRenamePlan. - Symbol
Overview Item - A single symbol entry from a file’s structure overview.
- Text
Range0 Based - A 0-based, half-open text range (LSP/wire convention: start inclusive, end exclusive).
- Truncation
- Truncation metadata for capped result sets (Backing B caps; spec Phase 3/4).
- Type
Hierarchy Node - A node in a type hierarchy (super/subtype tree).
- Usage
Site - A single semantic usage of the target symbol (declaration or reference),
returned by Backing B’s
RenameProcessor.findUsages.
Enums§
- Hierarchy
Direction - Direction for
type_hierarchyqueries. - Move
Target - Where a
movesends the symbol. Mirrors Serena’s two-field dispatch (targetRelativePathXORtargetParentNamePath, spec §3): the caller picks the variant, the backend never sees aname_path. Both variants carry the jail-checkedabs_pathplus the wire-facingrel_path(rebuilt by the IDE). - Reformat
Scope - Reformat scope (spec §5.3): the address is already resolved in
ctx_refactor; the trait sees only File / Region{range} / Symbol{range}, never aname_path.
Traits§
- LspBackend
- Code-intelligence backend.
Sendso instances can live in the globalBACKENDScache (Mutex<HashMap<String, Box<dyn LspBackend>>>).