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

Function links

__tests__/objcpp-cpp-items.test.ts:316–327  ·  view source on GitHub ↗

What a file's symbols call, reference and instantiate: "from -kind-> to", sorted.

(name: string, file: string)

Source from the content-addressed store, hash-verified

314
315 /** What a file's symbols call, reference and instantiate: "from -kind-> to", sorted. */
316 function links(name: string, file: string): string[] {
317 const cg = graphs.get(name)!;
318 const out: string[] = [];
319 for (const from of cg.getNodesInFile(file)) {
320 if (from.kind === 'file' || from.kind === 'import') continue;
321 for (const edge of cg.getOutgoingEdges(from.id)) {
322 if (edge.kind === 'contains') continue;
323 out.push(`${from.qualifiedName} -${edge.kind}-> ${cg.getNode(edge.target)!.qualifiedName}`);
324 }
325 }
326 return [...new Set(out)].sort();
327 }
328
329 /** The language each named symbol of a file was read as. */
330 function languages(name: string, file: string): Record<string, string> {

Callers 1

Calls 5

pushMethod · 0.80
getNodeMethod · 0.80
getMethod · 0.65
getNodesInFileMethod · 0.65
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected