Skip to main content

Module backend

Module backend 

Source
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). range is optional — some conflicts are scope-level, not tied to a single offset.
EditResult
Outcome of applying a RangeEdit.
InlineApply
Phase-2 inline request. NO force field — inline conflicts are partly non-overridable (spec §5.2, Entscheidung 4); the Rust gate is final.
InlineQuery
Phase-1 inline request: resolved source span. keep_definition maps to the IntelliJ inline processors’ “inline all and keep declaration” flag (spec §3, Befund 2). The trait never sees a name_path — exactly like move/safe_delete.
InspectionDiag
A single inspection/diagnostic result.
InspectionInfo
A single available inspection (the list mode of the inspections action).
MoveApply
Phase-2 move request: the query plus the force flag (Rust already gated plan_hash + conflicts before this is built).
MoveQuery
Phase-1 move request: the resolved source span plus an already-resolved, already-jailed target (the trait never resolves a name_path or a path).
RangeEdit
A resolved, ready-to-apply edit. The name_path → range resolution has already happened in ctx_refactor; the backend only ever sees an absolute path + range.
ReformatQuery
Single-Phase reformat request (spec §5.3): no usages, no plan_hash.
ReformatResult
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).
RenameApply
Apply request: same target addressing as RenameQuery plus the force flag (passed through to RenameProcessor; Rust has already gated conflicts).
RenamePlan
Outcome of rename_preview: every usage + every conflict. The plan_hash is built in Rust from this (see ctx_refactor::plan_hash), never here.
RenameQuery
Query for rename_preview: the target symbol is already resolved (name_path → range) in ctx_refactor; the backend only ever sees an absolute + relative path and a range, exactly like RangeEdit (no name_path on the wire).
RenameResult
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).
SafeDeleteApply
Phase-2 safe_delete request: force = Serena’s deleteEvenIfUsed, propagate = delete now-unreferenced dependencies too.
SafeDeleteQuery
Phase-1 safe_delete request: just the resolved source span. *_preview returns the remaining (blocking) usages in the reused RenamePlan.
SymbolOverviewItem
A single symbol entry from a file’s structure overview.
TextRange0Based
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).
TypeHierarchyNode
A node in a type hierarchy (super/subtype tree).
UsageSite
A single semantic usage of the target symbol (declaration or reference), returned by Backing B’s RenameProcessor.findUsages.

Enums§

HierarchyDirection
Direction for type_hierarchy queries.
MoveTarget
Where a move sends the symbol. Mirrors Serena’s two-field dispatch (targetRelativePath XOR targetParentNamePath, spec §3): the caller picks the variant, the backend never sees a name_path. Both variants carry the jail-checked abs_path plus the wire-facing rel_path (rebuilt by the IDE).
ReformatScope
Reformat scope (spec §5.3): the address is already resolved in ctx_refactor; the trait sees only File / Region{range} / Symbol{range}, never a name_path.

Traits§

LspBackend
Code-intelligence backend. Send so instances can live in the global BACKENDS cache (Mutex<HashMap<String, Box<dyn LspBackend>>>).