MCPcopy Index your code
hub / github.com/continuedev/continue / codeChunker

Function codeChunker

core/indexing/chunk/code.ts:246–263  ·  view source on GitHub ↗
(
  filepath: string,
  contents: string,
  maxChunkSize: number,
)

Source from the content-addressed store, hash-verified

244}
245
246export async function* codeChunker(
247 filepath: string,
248 contents: string,
249 maxChunkSize: number,
250): AsyncGenerator<ChunkWithoutID> {
251 if (contents.trim().length === 0) {
252 return;
253 }
254
255 const parser = await getParserForFile(filepath);
256 if (parser === undefined) {
257 throw new Error(`Failed to load parser for file ${filepath}: `);
258 }
259
260 const tree = parser.parse(contents);
261
262 yield* getSmartCollapsedChunks(tree.rootNode, contents, maxChunkSize);
263}

Callers 3

code.test.tsFile · 0.90
collectContentsFunction · 0.90
chunkDocumentWithoutIdFunction · 0.85

Calls 2

getParserForFileFunction · 0.85
getSmartCollapsedChunksFunction · 0.85

Tested by 1

collectContentsFunction · 0.72