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

Function context

__tests__/exact-name-binding.test.ts:14–26  ·  view source on GitHub ↗
(nodes: Node[], source = 'target();')

Source from the content-addressed store, hash-verified

12 startLine: 1, endLine: 1, startColumn: 0, endColumn: 0, updatedAt: 0, ...extra };
13}
14function context(nodes: Node[], source = 'target();'): ResolutionContext {
15 return {
16 getNodesByName: name => nodes.filter(n => n.name === name),
17 getNodesByLowerName: name => nodes.filter(n => n.name.toLowerCase() === name),
18 getNodesByQualifiedName: name => nodes.filter(n => n.qualifiedName === name),
19 getNodesByKind: kind => nodes.filter(n => n.kind === kind),
20 getNodesInFile: file => nodes.filter(n => n.filePath === file),
21 getImportMappings: () => [], getAllFiles: () => [], getProjectRoot: () => '/project',
22 fileExists: () => true,
23 readFile: file => file === 'lib/caller.js' ? source : 'function target() {}',
24 getFileLines: file => (file === 'lib/caller.js' ? source : 'function target() {}').split('\n'),
25 };
26}
27const ref: UnresolvedRef = { fromNodeId: 'caller', referenceName: 'target', referenceKind: 'calls',
28 filePath: 'lib/caller.js', language: 'javascript', line: 1, column: 0 };
29

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected