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

Function preferCallSiteFile

src/resolution/name-matcher.ts:535–544  ·  view source on GitHub ↗
(nodes: Node[], callSiteFile: string)

Source from the content-addressed store, hash-verified

533 * No-op when there are <2 candidates or none share the call site's file.
534 */
535export function preferCallSiteFile(nodes: Node[], callSiteFile: string): Node[] {
536 if (nodes.length < 2) return nodes;
537 const same: Node[] = [];
538 const other: Node[] = [];
539 for (const n of nodes) {
540 if (n.filePath === callSiteFile) same.push(n);
541 else other.push(n);
542 }
543 return same.length ? [...same, ...other] : nodes;
544}
545
546// Exported for the precedence unit tests (#1079): they assert the
547// preferredFqn → same-file → matches[0] ordering directly.

Callers 6

resolution.test.tsFile · 0.90
matchByQualifiedNameFunction · 0.85
resolveMethodOnTypeFunction · 0.85
matchMethodCallFunction · 0.85
matchGoFieldChainCallFunction · 0.85
matchReferenceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected