MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / nearestFile

Function nearestFile

src/search/query-paths.ts:489–493  ·  view source on GitHub ↗
(i: number)

Source from the content-addressed store, hash-verified

487 if (singleFileAt.size > 0) {
488 const pathIdx = [...singleFileAt.keys()];
489 const nearestFile = (i: number): string => {
490 let best = pathIdx[0]!;
491 for (const p of pathIdx) if (Math.abs(p - i) < Math.abs(best - i)) best = p;
492 return singleFileAt.get(best)!;
493 };
494 for (let i = 0; i < tokens.length; i++) {
495 if (consumed.has(i)) continue;
496 const tok = stripLineTokenPunctuation(tokens[i]!);

Callers 1

extractQueryPathsFunction · 0.85

Calls 1

getMethod · 0.65

Tested by

no test coverage detected