Xerp::Query::Snippet
Constants
CLUSTER_GAP = 4
Gap threshold - hits within this many lines are merged into one cluster.
DEFAULT_CONTEXT = 2
Context lines around each hit cluster.
ELLIPSIS = "..."
Ellipsis marker for non-contiguous regions.
HEADER_LINES = 2
Number of header lines to always include.
MAX_SNIPPET_LINES = 50
Maximum snippet size in lines (excluding ellipsis markers).
Class methods
extract(workspace_root : String, rel_path : String, block : Store::BlockRow, hit_lines : Array(Int32), max_lines : Int32 = MAX_SNIPPET_LINES, context_lines : Int32 = DEFAULT_CONTEXT) : String
Extracts a snippet from a file for a given block and hit lines.
extract_raw(workspace_root : String, rel_path : String, line_start : Int32, line_end : Int32) : String
Extracts just the raw lines without formatting.