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

Method constructor

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

Source from the content-addressed store, hash-verified

307 private workspacePackages: WorkspacePackages | null | undefined = undefined;
308
309 constructor(projectRoot: string, queries: QueryBuilder) {
310 this.projectRoot = projectRoot;
311 this.queries = queries;
312
313 const limit = resolveCacheLimit();
314 // The content cache is heavier (full file text), so we give it a
315 // smaller budget than the metadata caches.
316 const contentLimit = Math.max(64, Math.floor(limit / 5));
317 this.nodeCache = new LRUCache(limit);
318 this.fileCache = new LRUCache(contentLimit);
319 this.importMappingCache = new LRUCache(limit);
320 this.reExportCache = new LRUCache(limit);
321 this.nameCache = new LRUCache(limit);
322 this.lowerNameCache = new LRUCache(limit);
323 this.qualifiedNameCache = new LRUCache(limit);
324 // Split-lines arrays are heavier than content strings; refs arrive
325 // file-ordered, so a small cache still hits nearly always.
326 this.fileLinesCache = new LRUCache(contentLimit);
327 this.nodeByIdCache = new LRUCache(Math.max(limit * 4, 20_000));
328 this.methodMatchCache = new LRUCache(limit);
329
330 this.context = this.createContext();
331 }
332
333 /**
334 * Initialize the resolver (detect frameworks, etc.)

Callers

nothing calls this directly

Calls 2

createContextMethod · 0.95
resolveCacheLimitFunction · 0.85

Tested by

no test coverage detected