MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / resolveHop

Function resolveHop

graph-ui/src/traces/bug-paths.ts:674–699  ·  view source on GitHub ↗
(
    provider: HopResolver,
    root: string,
    hop: BugPathNode,
    opts: ProviderQueryOptions = {},
)

Source from the content-addressed store, hash-verified

672 * opens nothing rather than opening something plausible.
673 */
674export async function resolveHop(
675 provider: HopResolver,
676 root: string,
677 hop: BugPathNode,
678 opts: ProviderQueryOptions = {},
679): Promise<SymbolRef | undefined> {
680 if (hop.filePath !== undefined && hop.line !== undefined) {
681 const resolved = await provider
682 .resolveSymbolAt(root, hop.filePath, hop.line, opts)
683 .catch(() => undefined);
684 if (resolved?.kind === 'ok') {
685 return resolved.symbol;
686 }
687 }
688 const hits = await provider
689 .searchSymbols(root, hop.name, WIZARD_SEARCH_LIMIT, opts)
690 .catch(() => [] as SymbolSearchHit[]);
691 const match = pickHit(hits, hop);
692 if (match?.filePath === undefined || match.line === undefined) {
693 return undefined;
694 }
695 const resolved = await provider
696 .resolveSymbolAt(root, match.filePath, match.line, opts)
697 .catch(() => undefined);
698 return resolved?.kind === 'ok' ? resolved.symbol : undefined;
699}
700
701/**
702 * The candidate that is this hop, out of what the search returned.

Callers 2

ProjectWindowViewFunction · 0.90
bug-paths.test.tsFile · 0.90

Calls 3

pickHitFunction · 0.85
resolveSymbolAtMethod · 0.65
searchSymbolsMethod · 0.65

Tested by

no test coverage detected