MCPcopy Index your code
hub / github.com/CodeGraphContext/CodeGraphContext / getText

Function getText

website/public/wasm/web-tree-sitter.js:199–218  ·  view source on GitHub ↗
(tree, startIndex, endIndex, startPosition)

Source from the content-addressed store, hash-verified

197
198// src/tree.ts
199function getText(tree, startIndex, endIndex, startPosition) {
200 const length = endIndex - startIndex;
201 let result = tree.textCallback(startIndex, startPosition);
202 if (result) {
203 startIndex += result.length;
204 while (startIndex < endIndex) {
205 const string = tree.textCallback(startIndex, startPosition);
206 if (string && string.length > 0) {
207 startIndex += string.length;
208 result += string;
209 } else {
210 break;
211 }
212 }
213 if (startIndex > endIndex) {
214 result = result.slice(0, length);
215 }
216 }
217 return result ?? "";
218}
219__name(getText, "getText");
220var Tree = class _Tree {
221 static {

Callers 4

textMethod · 0.85
nodeTextMethod · 0.85
nodeTextMethod · 0.85
textMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected