File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -711,7 +711,8 @@ namespace ts.server {
711
711
catch { } // tslint:disable-line no-empty
712
712
}
713
713
714
- if ( err . message && err . message . indexOf ( `Could not find sourceFile:` ) !== - 1 ) {
714
+ if ( err . hasOwnProperty ( "ProgramFiles" ) ) {
715
+ msg += `\n\nProgram files: {(err as any)["ProgramFiles"]}\n` ;
715
716
msg += `\n\nProjects::\n` ;
716
717
let counter = 0 ;
717
718
const addProjectInfo = ( project : Project ) => {
Original file line number Diff line number Diff line change @@ -1158,7 +1158,12 @@ namespace ts {
1158
1158
function getValidSourceFile ( fileName : string ) : SourceFile {
1159
1159
const sourceFile = program . getSourceFile ( fileName ) ;
1160
1160
if ( ! sourceFile ) {
1161
- throw new Error ( `Could not find sourceFile: '${ fileName } '.` ) ;
1161
+ let error = new Error ( `Could not find sourceFile: '${ fileName } '.` ) ;
1162
+
1163
+ // Attach sidecar data for the server log
1164
+ ( error as any ) [ "ProgramFiles" ] = program && JSON . stringify ( program . getSourceFiles ( ) . map ( f => f . fileName ) ) ;
1165
+
1166
+ throw error ;
1162
1167
}
1163
1168
return sourceFile ;
1164
1169
}
You can’t perform that action at this time.
0 commit comments