MCPcopy Create free account
hub / github.com/PatrickSys/codebase-context / setParseTimeout

Function setParseTimeout

src/utils/tree-sitter.ts:85–100  ·  view source on GitHub ↗
(parser: Parser)

Source from the content-addressed store, hash-verified

83}
84
85function setParseTimeout(parser: Parser): void {
86 const maybeSetTimeout = (
87 parser as Parser & { setTimeoutMicros?: (timeout: number | bigint) => void }
88 ).setTimeoutMicros;
89 if (typeof maybeSetTimeout === 'function') {
90 try {
91 maybeSetTimeout.call(parser, TREE_SITTER_PARSE_TIMEOUT_MICROS);
92 } catch {
93 try {
94 maybeSetTimeout.call(parser, Number(TREE_SITTER_PARSE_TIMEOUT_MICROS));
95 } catch {
96 // Ignore timeout wiring failures; parser execution still proceeds.
97 }
98 }
99 }
100}
101
102function sliceUtf8(content: string, startIndex: number, endIndex: number): string {
103 const utf8 = Buffer.from(content, 'utf8');

Callers 2

extractTreeSitterSymbolsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected