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

Function shared

src/resolution/pascal-scope.ts:938–942  ·  view source on GitHub ↗
(f: string)

Source from the content-addressed store, hash-verified

936 // them (`mormot.core.os.pas` for `mormot.core.os.posix.inc`): how many
937 // characters of its path a file shares, the directory counting first.
938 const shared = (f: string): number => {
939 let n = 0;
940 while (n < f.length && n < incFile.length && f.charCodeAt(n) === incFile.charCodeAt(n)) n++;
941 return f.lastIndexOf('/', n - 1) * 1000 + n;
942 };
943 const candidates = projectFiles(context).pascal.filter((f) => f !== incFile)
944 .map((f) => ({ f, n: shared(f) })).sort((a, b) => b.n - a.n).slice(0, 40);
945 const includer = candidates.find(({ f }) => includesOf(f, context).includes(incFile))?.f ?? null;

Callers 1

includerOfFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected