Restore logging of the program file list

This commit is contained in:
Andrew Casey
2019-08-09 12:34:40 -07:00
parent d9780cd7ba
commit 6122e92802
2 changed files with 8 additions and 2 deletions

View File

@@ -711,7 +711,8 @@ namespace ts.server {
catch { } // tslint:disable-line no-empty
}
if (err.message && err.message.indexOf(`Could not find sourceFile:`) !== -1) {
if (err.hasOwnProperty("ProgramFiles")) {
msg += `\n\nProgram files: {(err as any)["ProgramFiles"]}\n`;
msg += `\n\nProjects::\n`;
let counter = 0;
const addProjectInfo = (project: Project) => {

View File

@@ -1158,7 +1158,12 @@ namespace ts {
function getValidSourceFile(fileName: string): SourceFile {
const sourceFile = program.getSourceFile(fileName);
if (!sourceFile) {
throw new Error(`Could not find sourceFile: '${fileName}'.`);
let error = new Error(`Could not find sourceFile: '${fileName}'.`);
// Attach sidecar data for the server log
(error as any)["ProgramFiles"] = program && JSON.stringify(program.getSourceFiles().map(f => f.fileName));
throw error;
}
return sourceFile;
}