@@ -1609,7 +1609,10 @@ namespace ts.server {
16091609 }
16101610
16111611 // No need to analyze lib.d.ts
1612- let fileNamesInProject = fileNames . filter ( value => value . indexOf ( "lib.d.ts" ) < 0 ) ;
1612+ const fileNamesInProject = fileNames . filter ( value => value . indexOf ( "lib.d.ts" ) < 0 ) ;
1613+ if ( fileNamesInProject . length === 0 ) {
1614+ return ;
1615+ }
16131616
16141617 // Sort the file name list to make the recently touched files come first
16151618 const highPriorityFiles : NormalizedPath [ ] = [ ] ;
@@ -1625,7 +1628,7 @@ namespace ts.server {
16251628 else {
16261629 const info = this . projectService . getScriptInfo ( fileNameInProject ) ;
16271630 if ( ! info . isScriptOpen ( ) ) {
1628- if ( fileNameInProject . indexOf ( Extension . Dts ) > 0 ) {
1631+ if ( fileExtensionIs ( fileNameInProject , Extension . Dts ) ) {
16291632 veryLowPriorityFiles . push ( fileNameInProject ) ;
16301633 }
16311634 else {
@@ -1638,14 +1641,11 @@ namespace ts.server {
16381641 }
16391642 }
16401643
1641- fileNamesInProject = highPriorityFiles . concat ( mediumPriorityFiles ) . concat ( lowPriorityFiles ) . concat ( veryLowPriorityFiles ) ;
1642-
1643- if ( fileNamesInProject . length > 0 ) {
1644- const checkList = fileNamesInProject . map ( fileName => ( { fileName, project } ) ) ;
1645- // Project level error analysis runs on background files too, therefore
1646- // doesn't require the file to be opened
1647- this . updateErrorCheck ( next , checkList , delay , /*requireOpen*/ false ) ;
1648- }
1644+ const sortedFiles = [ ...highPriorityFiles , ...mediumPriorityFiles , ...lowPriorityFiles , ...veryLowPriorityFiles ] ;
1645+ const checkList = sortedFiles . map ( fileName => ( { fileName, project } ) ) ;
1646+ // Project level error analysis runs on background files too, therefore
1647+ // doesn't require the file to be opened
1648+ this . updateErrorCheck ( next , checkList , delay , /*requireOpen*/ false ) ;
16491649 }
16501650
16511651 getCanonicalFileName ( fileName : string ) {
0 commit comments