Skip to main content

Module resolve

Module resolve 

Source
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?

FunctionUse CaseReturnsSuggestions
resolve_symbolPrimary API - Programmatic resolutionResolvedSpanNo
find_symbol_or_suggestUser-facing commandsNodeIdYes
resolve_symbol_with_rust_kindDeprecated - Use resolve_symbolResolvedSpanNo

§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§

ResolvedSpan
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_kindDeprecated
Backward compatibility: Resolve with Rust-specific symbol kind.