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

Method resolveCfmlIncludePath

src/resolution/index.ts:4317–4340  ·  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

4315 * in another case, so a single file that matches ignoring case counts too.
4316 */
4317 private resolveCfmlIncludePath(ref: UnresolvedRef): ResolvedRef | null {
4318 const written = ref.referenceName.trim().replace(/\\/g, '/');
4319 const fromRoot = written.startsWith('/');
4320 const parts = fromRoot ? [] : ref.filePath.replace(/\\/g, '/').split('/').slice(0, -1);
4321 for (const seg of written.split('/')) {
4322 if (seg === '' || seg === '.') continue;
4323 if (seg === '..') {
4324 if (parts.length === 0) return null; // above the project root
4325 parts.pop();
4326 } else {
4327 parts.push(seg);
4328 }
4329 }
4330 const fileName = parts[parts.length - 1];
4331 if (!fileName) return null;
4332 const wanted = parts.join('/');
4333 const files = this.context.getNodesByLowerName(fileName.toLowerCase()).filter((n) => n.kind === 'file');
4334 const exact = files.find((n) => n.filePath === wanted);
4335 if (exact) return { original: ref, targetNodeId: exact.id, confidence: fromRoot ? 0.85 : 0.95, resolvedBy: 'file-path' };
4336 const folded = files.filter((n) => n.filePath.toLowerCase() === wanted.toLowerCase());
4337 return folded.length === 1
4338 ? { original: ref, targetNodeId: folded[0]!.id, confidence: fromRoot ? 0.8 : 0.9, resolvedBy: 'file-path' }
4339 : null;
4340 }
4341
4342 /**
4343 * 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