Skip to main content

chunk_file

Function chunk_file 

Source
pub fn chunk_file<D: Doc>(
    root: &AstGrep<D>,
    source: &str,
    file_path: &str,
    symbols: &[Symbol],
    config: &ChunkConfig,
) -> Vec<CodeChunk>
where D::Lang: Language,
Expand description

Chunk a file using its CST tree.

  • root: the ast-grep parsed root (AstGrep instance).
  • source: the raw source string.
  • file_path: path to the source file (stored in each chunk).
  • symbols: symbols extracted from this file (used for parent resolution).
  • config: chunking parameters.