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

Function targetsAt

__tests__/csharp-namespace-scope.test.ts:143–147  ·  view source on GitHub ↗
(file: string, line: number, kind?: string)

Source from the content-addressed store, hash-verified

141
142const qualifiedNames = (file: string) => cg.getNodesInFile(file).filter((n) => n.kind !== 'file').map((n) => `${n.kind} ${n.qualifiedName}`);
143const targetsAt = (file: string, line: number, kind?: string) => {
144 const ids = cg.getNodesInFile(file).map((n) => n.id);
145 return cg.getOutgoingEdgesFrom(ids).filter((e) => e.line === line && (!kind || e.kind === kind))
146 .map((e) => cg.getNode(e.target)!).map((t) => `${t.kind} ${t.filePath}:${t.qualifiedName}`);
147};
148
149describe('C# namespaces, usings and nested types', () => {
150 it('a block namespace qualifies only its own body', () => {

Callers 1

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesInFileMethod · 0.65
getOutgoingEdgesFromMethod · 0.45

Tested by

no test coverage detected