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

Method extractIncludeTag

src/extraction/cfml-extractor.ts:587–622  ·  view source on GitHub ↗

* ` ` (#2651) includes the template * as cfscript's `include "formlistshared.cfm";` does, so it is extracted the * same way: an import node in the scope it sits in (the function, the * component, or the file of a template) and an `imports` reference f

(tag: SyntaxNode, scopeId: string)

Source from the content-addressed store, hash-verified

585 * runtime (`template="#dir#/x.cfm"`) names no file the index can link.
586 */
587 private extractIncludeTag(tag: SyntaxNode, scopeId: string): void {
588 const valueNode = this.tagAttrValueNode(tag, 'template', true);
589 const template = valueNode ? this.source.substring(valueNode.startIndex, valueNode.endIndex).trim() : '';
590 if (!template) return;
591 // Qualified like the generic extractor's import nodes: under the scope's
592 // own name, without the file path (`baseform::formlistshared.cfm`).
593 const scope = this.nodes.find((n) => n.id === scopeId);
594 const prefix = !scope || scope.kind === 'file' ? '' : scope.kind === 'method' ? scope.qualifiedName : scope.name;
595 const line = tag.startPosition.row + 1;
596 const column = tag.startPosition.column;
597 const id = this.nodeIds.generate(this.filePath, 'import', template, line, column);
598 this.nodes.push({
599 id,
600 kind: 'import',
601 name: template,
602 qualifiedName: prefix ? `${prefix}::${template}` : template,
603 filePath: this.filePath,
604 language: this.language,
605 startLine: line,
606 endLine: tag.endPosition.row + 1,
607 startColumn: column,
608 endColumn: tag.endPosition.column,
609 signature: this.source.substring(tag.startIndex, tag.endIndex).trim(),
610 updatedAt: Date.now(),
611 });
612 this.edges.push({ source: scopeId, target: id, kind: 'contains' });
613 this.unresolvedReferences.push({
614 fromNodeId: scopeId,
615 referenceName: template,
616 referenceKind: 'imports',
617 filePath: this.filePath,
618 line,
619 column,
620 language: this.language,
621 });
622 }
623
624 /**
625 * Delegate a `<cfscript>...</cfscript>` tag body to the cfscript grammar.

Callers 1

visitTagMethod · 0.95

Calls 3

tagAttrValueNodeMethod · 0.95
pushMethod · 0.80
generateMethod · 0.45

Tested by

no test coverage detected