MCPcopy Create free account
hub / github.com/Snapchat/Valdi / doOpenFile

Method doOpenFile

compiler/companion/src/Workspace.ts:179–192  ·  view source on GitHub ↗
(fileName: string)

Source from the content-addressed store, hash-verified

177 this.scheduleFlushOpenQueuedFiles();
178 });
179 }
180
181 private doOpenFile(fileName: string): OpenFileResult {
182 this.logger?.debug?.(`Opening file ${fileName}`);
183 const sourceFile = this.project.openSourceFile(fileName);
184 const relativeImportPaths = getImportStringLiteralsFromSourceFile(sourceFile).map((lit) => lit.text);
185 const isTypeScriptFile = fileName.endsWith('.ts') || fileName.endsWith('.tsx');
186 const importPaths: OpenFileImportPath[] = relativeImportPaths.map((i) => {
187 return { relative: i, absolute: this.resolveImportPath(sourceFile.fileName, i) };
188 });
189
190 return {
191 importPaths,
192 isNonModuleWithAmbiantDeclarations: isTypeScriptFile && isNonModuleWithAmbiantDeclarations(sourceFile),
193 };
194 }
195

Callers 2

initializeMethod · 0.95
openQueuedFilesMethod · 0.95

Calls 6

resolveImportPathMethod · 0.95
debugMethod · 0.80
openSourceFileMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected