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

Function extractNodeContent

src/utils/tree-sitter.ts:107–116  ·  view source on GitHub ↗
(node: Node, content: string)

Source from the content-addressed store, hash-verified

105}
106
107function extractNodeContent(node: Node, content: string): string {
108 const byteSlice = sliceUtf8(content, node.startIndex, node.endIndex);
109 const codeUnitSlice = content.slice(node.startIndex, node.endIndex);
110
111 if (node.text === codeUnitSlice && node.text !== byteSlice) {
112 return codeUnitSlice;
113 }
114
115 return byteSlice;
116}
117
118function isTreeSitterDebugEnabled(): boolean {
119 return Boolean(process.env.CODEBASE_CONTEXT_DEBUG);

Callers 1

buildSymbolFunction · 0.85

Calls 1

sliceUtf8Function · 0.85

Tested by

no test coverage detected