Skip to main content

chunk_file

Function chunk_file 

Source
pub fn chunk_file(
    path: &Path,
    source: &str,
    config: &LangConfig,
    chunk_config: &ChunkConfig,
) -> Vec<CodeChunk>
Expand description

Extract semantic chunks from a source file.

Uses tree-sitter to parse the file and extract definitions matching the language’s query patterns. For files with no semantic matches, falls back to overlapping sliding windows. Large individual chunks are also split into windows.

Pass a ChunkConfig to control chunk sizing at runtime.