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

Method addVariable

src/extraction/liquid-extractor.ts:487–514  ·  view source on GitHub ↗

A `variable` node, contained by the file, for a declaration that `findTagOccurrences` found.

(fileNodeId: string, variableName: string, match: { fullMatch: string; index: number })

Source from the content-addressed store, hash-verified

485
486 /** A `variable` node, contained by the file, for a declaration that `findTagOccurrences` found. */
487 private addVariable(fileNodeId: string, variableName: string, match: { fullMatch: string; index: number }): void {
488 const line = this.getLineNumber(match.index);
489 const column = match.index - this.getLineStart(line);
490 const nodeId = this.nodeIds.generate(this.filePath, 'variable', variableName, line, column);
491
492 const node: Node = {
493 id: nodeId,
494 kind: 'variable',
495 name: variableName,
496 qualifiedName: `${this.filePath}::${variableName}`,
497 filePath: this.filePath,
498 language: 'liquid',
499 startLine: line,
500 endLine: line,
501 startColumn: column,
502 endColumn: column + match.fullMatch.length,
503 updatedAt: Date.now(),
504 };
505
506 this.nodes.push(node);
507
508 // Add containment edge from file
509 this.edges.push({
510 source: fileNodeId,
511 target: nodeId,
512 kind: 'contains',
513 });
514 }
515
516 /**
517 * Get the line number for a character index

Callers 1

extractAssignmentsMethod · 0.95

Calls 4

getLineNumberMethod · 0.95
getLineStartMethod · 0.95
pushMethod · 0.80
generateMethod · 0.45

Tested by

no test coverage detected