A `variable` node, contained by the file, for a declaration that `findTagOccurrences` found.
(fileNodeId: string, variableName: string, match: { fullMatch: string; index: number })
| 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 |
no test coverage detected