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

Function resolve

src/ui-server/api/when.ts:154–170  ·  view source on GitHub ↗
(caller: { filePath: string; language: Language })

Source from the content-addressed store, hash-verified

152 const texts = new Map<string, string | null>();
153 let sites = 0;
154 const resolve = (caller: { filePath: string; language: Language }): { abs: string; language: Language } | null => {
155 const posix = caller.filePath.replace(/\\/g, '/');
156 let file = files.get(posix);
157 if (file === undefined) {
158 file = null;
159 const found = findIndexedFile(cg, posix);
160 if (found && !hasDriftedOnDisk(projectRoot, found.storedPath, found.record)) {
161 try {
162 file = { abs: resolveProjectFile(projectRoot, found.storedPath), language: found.record.language as Language };
163 } catch {
164 file = null;
165 }
166 }
167 files.set(posix, file);
168 }
169 return file;
170 };
171 /** A file's text, once, for the directive and declaration reads; null past the size cap or unreadable. */
172 const readText = (abs: string): string | null => {
173 let text = texts.get(abs);

Callers 15

guardsFunction · 0.70
loopsFunction · 0.70
argsFunction · 0.70
triggerFunction · 0.70
callSiteFunction · 0.70
decoratorsFunction · 0.70
memberTypesFunction · 0.70
returnsFunction · 0.70
directiveFunction · 0.70
swiftExtensionFunction · 0.70
closeMethod · 0.50
finishFunction · 0.50

Calls 5

findIndexedFileFunction · 0.90
hasDriftedOnDiskFunction · 0.90
resolveProjectFileFunction · 0.90
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected