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

Function emitFileImport

src/extraction/languages/nix.ts:155–172  ·  view source on GitHub ↗

Import node + unresolved `imports` ref for a static project path.

(ctx: ExtractorContext, importPath: string, anchorNode: SyntaxNode, source: string)

Source from the content-addressed store, hash-verified

153
154/** Import node + unresolved `imports` ref for a static project path. */
155function emitFileImport(ctx: ExtractorContext, importPath: string, anchorNode: SyntaxNode, source: string): void {
156 const impNode = ctx.createNode('import', importPath, anchorNode, {
157 signature: getNodeText(anchorNode, source).trim().slice(0, 100),
158 });
159
160 if (impNode && ctx.nodeStack.length > 0) {
161 const fromNodeId = ctx.nodeStack[ctx.nodeStack.length - 1];
162 if (fromNodeId) {
163 ctx.addUnresolvedReference({
164 fromNodeId,
165 referenceName: importPath,
166 referenceKind: 'imports',
167 line: anchorNode.startPosition.row + 1,
168 column: anchorNode.startPosition.column,
169 });
170 }
171 }
172}
173
174export const nixExtractor: LanguageExtractor = {
175 functionTypes: [],

Callers 1

nix.tsFile · 0.85

Calls 3

getNodeTextFunction · 0.90
createNodeMethod · 0.65

Tested by

no test coverage detected