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

Method matchesAnyImport

src/resolution/index.ts:838–850  ·  view source on GitHub ↗

* Does `ref.referenceName` match an import declared in its containing * file? Used as a pre-filter escape so re-export chain resolution * still gets a chance when the name has no project-wide declaration.

(ref: UnresolvedRef)

Source from the content-addressed store, hash-verified

836 * still gets a chance when the name has no project-wide declaration.
837 */
838 private matchesAnyImport(ref: UnresolvedRef): boolean {
839 const imports = this.context.getImportMappings(ref.filePath, ref.language);
840 if (imports.length === 0) return false;
841 for (const imp of imports) {
842 if (
843 imp.localName === ref.referenceName ||
844 ref.referenceName.startsWith(imp.localName + '.')
845 ) {
846 return true;
847 }
848 }
849 return false;
850 }
851
852 /**
853 * Resolve a single reference

Callers 1

resolveOneMethod · 0.95

Calls 1

getImportMappingsMethod · 0.80

Tested by

no test coverage detected