From 78554698d0dd2238ed5794bde256a51c921c3854 Mon Sep 17 00:00:00 2001 From: rjmacarthy Date: Fri, 2 Aug 2024 20:40:55 +0100 Subject: [PATCH] lint --- src/extension/utils.ts | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/src/extension/utils.ts b/src/extension/utils.ts index 552dc240..75ea66b4 100644 --- a/src/extension/utils.ts +++ b/src/extension/utils.ts @@ -39,7 +39,6 @@ import { } from '../common/constants' import { Logger } from '../common/logger' import { SyntaxNode } from 'web-tree-sitter' -import { getParser } from './parser-utils' const logger = new Logger() @@ -450,44 +449,6 @@ export const getSanitizedCommitMessage = (commitMessage: string) => { export const getNormalisedText = (text: string) => text.replace(NORMALIZE_REGEX, ' ') -export async function getDocumentSplitChunks( - content: string, - filePath: string, - chunkSize = 500 -): Promise { - const parser = await getParser(filePath) - - if (!parser) return [] - - const tree = parser.parse(content) - const chunks: string[] = [] - - function getSplitChunks(node: SyntaxNode): void { - for (const child of node.children) { - if (child.text.length > 100) { - getSplitChunks(child) - continue - } - chunks.push(child.text) - } - } - - getSplitChunks(tree.rootNode) - - const finalChunks = [] - let buffer = '' - for (const chunk of chunks) { - if (buffer.length + chunk.length < chunkSize) { - buffer += chunk + ' ' - } else { - finalChunks.push(buffer.trim()) - buffer = chunk + ' ' - } - } - - return finalChunks -} - export const logStreamOptions = (opts: StreamRequest) => { logger.log( `