(openedFile: OpenedFile, output: Diagnostic[])
| 355 | |
| 356 | return { start, end, text, category: 'error' }; |
| 357 | } |
| 358 | |
| 359 | private validateImports(openedFile: OpenedFile, output: Diagnostic[]): boolean { |
| 360 | const importPaths = getImportStringLiteralsFromSourceFile(openedFile.sourceFile); |
| 361 | let success = true; |
| 362 | |
| 363 | for (const importPath of importPaths) { |
| 364 | const resolvedImportPath = this.resolveImportPath(openedFile.sourceFile.fileName, importPath.text); |
| 365 | const resolvedPath = this.project.resolvePath(resolvedImportPath); |
| 366 | const pathToCheck = this.importPathResolver.getAlias(resolvedPath) ?? resolvedPath; |
| 367 | |
| 368 | if (!this.project.fileExists(pathToCheck.absolutePath)) { |
| 369 | const errorMessage = `File '${importPath.text}' does not exist`; |
| 370 | output.push(this.makeDiagnostic(openedFile.sourceFile, importPath, errorMessage)); |
| 371 | success = false; |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | return success; |
| 376 | } |
| 377 |
no test coverage detected