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

Method constructor

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

Source from the content-addressed store, hash-verified

485 private moduleConfigFiles = new Set<string>();
486
487 constructor(projectRoot: string, queries: QueryBuilder) {
488 this.projectRoot = projectRoot;
489 this.queries = queries;
490
491 const limit = resolveCacheLimit();
492 // The content cache is heavier (full file text), so we give it a
493 // smaller budget than the metadata caches.
494 const contentLimit = Math.max(64, Math.floor(limit / 5));
495 this.nodeCache = new LRUCache(limit);
496 this.fileCache = new LRUCache(contentLimit);
497 this.importMappingCache = new LRUCache(limit);
498 this.reExportCache = new LRUCache(limit);
499 this.nameCache = new LRUCache(limit);
500 this.lowerNameCache = new LRUCache(limit);
501 this.qualifiedNameCache = new LRUCache(limit);
502 // Split-lines arrays are heavier than content strings; refs arrive
503 // file-ordered, so a small cache still hits nearly always.
504 this.fileLinesCache = new LRUCache(contentLimit);
505 this.nodeByIdCache = new LRUCache(Math.max(limit * 4, 20_000));
506 this.methodMatchCache = new LRUCache(limit);
507
508 this.context = this.createContext();
509 }
510
511 /**
512 * 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