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

Method constructor

src/resolution/index.ts:576–598  ·  view source on GitHub ↗
(projectRoot: string, queries: QueryBuilder)

Source from the content-addressed store, hash-verified

574 private moduleConfigFiles = new Set<string>();
575
576 constructor(projectRoot: string, queries: QueryBuilder) {
577 this.projectRoot = projectRoot;
578 this.queries = queries;
579
580 const limit = resolveCacheLimit();
581 // The content cache is heavier (full file text), so we give it a
582 // smaller budget than the metadata caches.
583 const contentLimit = Math.max(64, Math.floor(limit / 5));
584 this.nodeCache = new LRUCache(limit);
585 this.fileCache = new LRUCache(contentLimit);
586 this.importMappingCache = new LRUCache(limit);
587 this.reExportCache = new LRUCache(limit);
588 this.nameCache = new LRUCache(limit);
589 this.lowerNameCache = new LRUCache(limit);
590 this.qualifiedNameCache = new LRUCache(limit);
591 // Split-lines arrays are heavier than content strings; refs arrive
592 // file-ordered, so a small cache still hits nearly always.
593 this.fileLinesCache = new LRUCache(contentLimit);
594 this.nodeByIdCache = new LRUCache(Math.max(limit * 4, 20_000));
595 this.methodMatchCache = new LRUCache(limit);
596
597 this.context = this.createContext();
598 }
599
600 /**
601 * Initialize the resolver (detect frameworks, etc.). `frameworks` are the

Callers

nothing calls this directly

Calls 2

createContextMethod · 0.95
resolveCacheLimitFunction · 0.85

Tested by

no test coverage detected