MCPcopy
hub / github.com/continuedev/continue / maybeYieldChunk

Function maybeYieldChunk

core/indexing/chunk/code.ts:193–211  ·  view source on GitHub ↗
(
  node: SyntaxNode,
  code: string,
  maxChunkSize: number,
  root = true,
)

Source from the content-addressed store, hash-verified

191};
192
193async function maybeYieldChunk(
194 node: SyntaxNode,
195 code: string,
196 maxChunkSize: number,
197 root = true,
198): Promise<ChunkWithoutID | undefined> {
199 // Keep entire text if not over size
200 if (root || node.type in collapsedNodeConstructors) {
201 const tokenCount = await countTokensAsync(node.text);
202 if (tokenCount < maxChunkSize) {
203 return {
204 content: node.text,
205 startLine: node.startPosition.row,
206 endLine: node.endPosition.row,
207 };
208 }
209 }
210 return undefined;
211}
212
213async function* getSmartCollapsedChunks(
214 node: SyntaxNode,

Callers 1

getSmartCollapsedChunksFunction · 0.85

Calls 1

countTokensAsyncFunction · 0.85

Tested by

no test coverage detected