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

Function resolve

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

Source from the content-addressed store, hash-verified

145 const texts = new Map<string, string | null>();
146 let sites = 0;
147 const resolve = (caller: { filePath: string; language: Language }): { abs: string; language: Language } | null => {
148 const posix = caller.filePath.replace(/\\/g, '/');
149 let file = files.get(posix);
150 if (file === undefined) {
151 file = null;
152 const found = findIndexedFile(cg, posix);
153 if (found && !hasDriftedOnDisk(projectRoot, found.storedPath, found.record)) {
154 try {
155 file = { abs: resolveProjectFile(projectRoot, found.storedPath), language: found.record.language as Language };
156 } catch {
157 file = null;
158 }
159 }
160 files.set(posix, file);
161 }
162 return file;
163 };
164 // Named rather than a method, because `createWhenReader` hands `when` out
165 // detached: it must not depend on `this`.
166 const guards = async (

Callers 15

guardsFunction · 0.70
loopsFunction · 0.70
argsFunction · 0.70
triggerFunction · 0.70
callSiteFunction · 0.70
decoratorsFunction · 0.70
memberTypesFunction · 0.70
directiveFunction · 0.70
closeMethod · 0.50
finishFunction · 0.50
probeDaemonIdentityFunction · 0.50
listenMethod · 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