File tree 1 file changed +9
-0
lines changed 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -471,6 +471,15 @@ namespace ts.server {
471
471
// - newProgram is different from the old program and structure of the old program was not reused.
472
472
if ( ! oldProgram || ( this . program !== oldProgram && ! oldProgram . structureIsReused ) ) {
473
473
hasChanges = true ;
474
+
475
+ const options = this . getCompilerOptions ( ) ;
476
+ if ( ( this . projectKind === ProjectKind . Inferred || this . projectKind === ProjectKind . External ) && ! options . noEmit && allFilesAreJsOrDts ( this ) ) {
477
+ options . noEmit = true ;
478
+ this . lsHost . setCompilationSettings ( options ) ;
479
+ // need to get a new program as the compiler option changed.
480
+ this . program = this . languageService . getProgram ( ) ;
481
+ }
482
+
474
483
if ( oldProgram ) {
475
484
for ( const f of oldProgram . getSourceFiles ( ) ) {
476
485
if ( this . program . getSourceFileByPath ( f . path ) ) {
You can’t perform that action at this time.
0 commit comments