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

Method extractIncludeTag

src/extraction/cfml-extractor.ts:584–619  ·  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

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