Function process_file_for_extraction

Source
pub fn process_file_for_extraction(
    path: &Path,
    start_line: Option<usize>,
    end_line: Option<usize>,
    symbol: Option<&str>,
    allow_tests: bool,
    context_lines: usize,
    specific_lines: Option<&HashSet<usize>>,
) -> Result<SearchResult>
Expand description

Process a single file and extract code blocks

If a line range is specified, we find all AST blocks overlapping that range, merge them into a bounding block, and return it. If no blocks are found, fallback to the literal lines. If only a single line is specified, do the same but for that line. If a symbol is specified, we delegate to find_symbol_in_file. If specific lines are provided, we find AST blocks for each line and merge them. If no lines or symbol are specified, return the entire file.

This function returns a single SearchResult that includes either the merged AST code or the literal lines as a fallback.