File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed
src/services/code-index/processors Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import { scannerExtensions } from "../shared/supported-extensions"
99const MAX_BLOCK_CHARS = 1000
1010const MIN_BLOCK_CHARS = 100
1111const MIN_CHUNK_REMAINDER_CHARS = 200 // Minimum characters for the *next* chunk after a split
12+ const MAX_CHARS_TOLERANCE_FACTOR = 1.15 // 15% tolerance for max chars
1213
1314/**
1415 * Implementation of the code parser interface
@@ -150,7 +151,7 @@ export class CodeParser implements ICodeParser {
150151 // Check if the node meets the minimum character requirement
151152 if ( currentNode . text . length >= MIN_BLOCK_CHARS ) {
152153 // If it also exceeds the maximum character limit, try to break it down
153- if ( currentNode . text . length > MAX_BLOCK_CHARS ) {
154+ if ( currentNode . text . length > MAX_BLOCK_CHARS * MAX_CHARS_TOLERANCE_FACTOR ) {
154155 if ( currentNode . children . length > 0 ) {
155156 // If it has children, process them instead
156157 queue . push ( ...currentNode . children )
You can’t perform that action at this time.
0 commit comments