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

Method resolveCfmlIncludePath

src/resolution/index.ts:4096–4119  ·  view source on GitHub ↗

* The file a CFML include names (#2651) — `include "x.cfm";`, * ` `, `cfinclude(template="x.cfm")`. A template * path is relative to the directory of the file that includes it * (`formlistshared.cfm`, `../shared/helpers.cfm`), or to the web root when * it start

(ref: UnresolvedRef)

Source from the content-addressed store, hash-verified

4094 * in another case, so a single file that matches ignoring case counts too.
4095 */
4096 private resolveCfmlIncludePath(ref: UnresolvedRef): ResolvedRef | null {
4097 const written = ref.referenceName.trim().replace(/\\/g, '/');
4098 const fromRoot = written.startsWith('/');
4099 const parts = fromRoot ? [] : ref.filePath.replace(/\\/g, '/').split('/').slice(0, -1);
4100 for (const seg of written.split('/')) {
4101 if (seg === '' || seg === '.') continue;
4102 if (seg === '..') {
4103 if (parts.length === 0) return null; // above the project root
4104 parts.pop();
4105 } else {
4106 parts.push(seg);
4107 }
4108 }
4109 const fileName = parts[parts.length - 1];
4110 if (!fileName) return null;
4111 const wanted = parts.join('/');
4112 const files = this.context.getNodesByLowerName(fileName.toLowerCase()).filter((n) => n.kind === 'file');
4113 const exact = files.find((n) => n.filePath === wanted);
4114 if (exact) return { original: ref, targetNodeId: exact.id, confidence: fromRoot ? 0.85 : 0.95, resolvedBy: 'file-path' };
4115 const folded = files.filter((n) => n.filePath.toLowerCase() === wanted.toLowerCase());
4116 return folded.length === 1
4117 ? { original: ref, targetNodeId: folded[0]!.id, confidence: fromRoot ? 0.8 : 0.9, resolvedBy: 'file-path' }
4118 : null;
4119 }
4120
4121 /**
4122 * Resolve a `this.<member>` function-as-value reference (#756/#808) to the

Callers 1

resolveOneInnerMethod · 0.95

Calls 3

pushMethod · 0.80
getNodesByLowerNameMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected