pub trait PreciseBackend: Send + Sync {
// Required methods
fn find_definitions(
&self,
symbol: &str,
file_path: &str,
line: usize,
) -> Result<Vec<SearchCandidate>>;
fn find_references(
&self,
symbol: &str,
file_path: &str,
line: usize,
) -> Result<Vec<SearchCandidate>>;
fn hover(
&self,
file_path: &str,
line: usize,
column: usize,
) -> Result<Option<String>>;
fn diagnostics(&self, file_path: &str) -> Result<Vec<CodeDiagnostic>>;
fn source(&self) -> IntelligenceSource;
fn has_index_for(&self, file_path: &str) -> bool;
}Expand description
Trait for optional precise code intelligence backends (LSP, SCIP).
The engine’s default fast path uses tree-sitter for all operations. When a precise backend is available, it supplements or replaces tree-sitter results with type-aware, cross-file intelligence.
Implementors: ScipIndex (planned), LspClient (planned).
§Usage
ⓘ
if let Some(precise) = engine.precise_backend() {
let defs = precise.find_definitions("MyStruct", "src/lib.rs", 42)?;
// defs carry IntelligenceSource::Scip or ::Lsp
} else {
// fall back to tree-sitter search
}Required Methods§
Sourcefn find_definitions(
&self,
symbol: &str,
file_path: &str,
line: usize,
) -> Result<Vec<SearchCandidate>>
fn find_definitions( &self, symbol: &str, file_path: &str, line: usize, ) -> Result<Vec<SearchCandidate>>
Find definitions of a symbol at the given location.
Sourcefn find_references(
&self,
symbol: &str,
file_path: &str,
line: usize,
) -> Result<Vec<SearchCandidate>>
fn find_references( &self, symbol: &str, file_path: &str, line: usize, ) -> Result<Vec<SearchCandidate>>
Find all references to a symbol at the given location.
Sourcefn hover(
&self,
file_path: &str,
line: usize,
column: usize,
) -> Result<Option<String>>
fn hover( &self, file_path: &str, line: usize, column: usize, ) -> Result<Option<String>>
Get hover documentation for a symbol.
Sourcefn diagnostics(&self, file_path: &str) -> Result<Vec<CodeDiagnostic>>
fn diagnostics(&self, file_path: &str) -> Result<Vec<CodeDiagnostic>>
Get diagnostics for a file.
Sourcefn source(&self) -> IntelligenceSource
fn source(&self) -> IntelligenceSource
Which intelligence source this backend provides.
Sourcefn has_index_for(&self, file_path: &str) -> bool
fn has_index_for(&self, file_path: &str) -> bool
Whether this backend has an index for the given file.