Expand description
Scope-label heuristics for chunks.
Given the index’s tree-sitter symbol table and a chunk, produce a short human-readable label answering “what does this chunk show?”.
Used by formatters (CLI, MCP) to enrich result headers — an agent or
human reading the line crates/foo/bar.rs:46-95 [score=0.025] gets
a much faster answer to “is this relevant?” when the line ends with
defines `Manifest``` or in `fn handle_search```.
Two entry points:
chunk_scope_label— one-shot label lookup. Iterates the full symbol slice; fine for one or two labels per call (CLI format, MCP refs handler).ScopeIndex— pre-builds afile_path → symbol indicesmap so each subsequent label call isO(symbols_in_file)instead ofO(total_symbols). The right choice for the TUI render loop, which resolves ~30 labels per redraw.
Structs§
- Scope
Index - Pre-indexed
file_path → symbol indicesmap for fast repeated scope-label lookups (the TUI render loop).
Functions§
- chunk_
scope_ label - Pick a short scope label for a chunk so a reader can route on the result header without reading the body.