@@ -80,7 +80,7 @@ class MemoryCache {
80
80
fileContents = new Map < string , string > ( )
81
81
fileVersions = new Map < string , number > ( )
82
82
83
- constructor ( public rootFileNames : string [ ] = [ ] ) {
83
+ constructor ( rootFileNames : string [ ] = [ ] ) {
84
84
for ( const fileName of rootFileNames ) this . fileVersions . set ( fileName , 1 )
85
85
}
86
86
}
@@ -296,7 +296,7 @@ export function register (opts: Options = {}): Register {
296
296
297
297
// Create the compiler host for type checking.
298
298
const serviceHost : _ts . LanguageServiceHost = {
299
- getScriptFileNames : ( ) => memoryCache . rootFileNames ,
299
+ getScriptFileNames : ( ) => Array . from ( memoryCache . fileVersions . keys ( ) ) ,
300
300
getScriptVersion : ( fileName : string ) => {
301
301
const version = memoryCache . fileVersions . get ( fileName )
302
302
return version === undefined ? '' : version . toString ( )
@@ -335,9 +335,6 @@ export function register (opts: Options = {}): Register {
335
335
const updateMemoryCache = function ( contents : string , fileName : string ) {
336
336
const fileVersion = memoryCache . fileVersions . get ( fileName ) || 0
337
337
338
- // Add to `rootFiles` when discovered for the first time.
339
- if ( fileVersion === 0 ) memoryCache . rootFileNames . push ( fileName )
340
-
341
338
// Avoid incrementing cache when nothing has changed.
342
339
if ( memoryCache . fileContents . get ( fileName ) === contents ) return
343
340
0 commit comments