Expand description
Deterministic symbol resolution with ambiguity detection.
This module provides file-aware, deterministic symbol resolution. Name-only resolution is forbidden unless uniquely provable. Supports multi-language code analysis. Provides enhanced symbol lookup with “did you mean” functionality.
§Symbol Resolution API
This module provides file-aware, deterministic symbol resolution with ambiguity detection and fuzzy matching suggestions.
§Which function should I use?
| Function | Use Case | Returns | Suggestions |
|---|---|---|---|
resolve_symbol | Primary API - Programmatic resolution | ResolvedSpan | No |
find_symbol_or_suggest | User-facing commands | NodeId | Yes |
resolve_symbol_with_rust_kind | Deprecated - Use resolve_symbol | ResolvedSpan | No |
§Quick Examples
§Basic resolution (with file context)
use splice::resolve::resolve_symbol;
use splice::graph::CodeGraph;
let graph = CodeGraph::open(std::path::Path::new("splice.db"))?;
let symbol = resolve_symbol(
&graph,
Some(std::path::Path::new("src/main.rs")), // file context
Some("function"), // kind filter
"main" // symbol name
)?;§User-friendly lookup with suggestions
ⓘ
use splice::resolve::find_symbol_or_suggest;
use splice::graph::CodeGraph;
// Returns helpful suggestions if symbol name is misspelled
let graph = CodeGraph::open(".magellan/splice.db").unwrap();
match find_symbol_or_suggest(&graph, "my_functoin", None) {
Ok(id) => println!("Found: {:?}", id),
Err(e) => eprintln!("{}", e), // "Did you mean: my_function?"
}Modules§
- cross_
file - Cross-file symbol resolution.
- module_
resolver - Module path resolution.
- references
- Symbol reference finding using tree-sitter.
Structs§
- Resolved
Span - A resolved symbol with complete location information.
Functions§
- find_
symbol_ or_ suggest - Find a symbol, providing suggestions if not found.
- normalize_
lookup_ path - Normalize a user-provided path for database lookup.
- resolve_
symbol - Resolve a symbol to its span with file-aware disambiguation.
- resolve_
symbol_ with_ rust_ kind Deprecated - Backward compatibility: Resolve with Rust-specific symbol kind.