@@ -326,29 +326,28 @@ namespace ts.Completions.PathCompletions {
326326
327327 if ( typeRoots ) {
328328 for ( const root of typeRoots ) {
329- getCompletionEntriesFromDirectories ( host , root , span , result ) ;
329+ getCompletionEntriesFromDirectories ( root ) ;
330330 }
331331 }
332- }
333332
334- if ( host . getDirectories ) {
335333 // Also get all @types typings installed in visible node_modules directories
336334 for ( const packageJson of findPackageJsons ( scriptPath , host ) ) {
337335 const typesDir = combinePaths ( getDirectoryPath ( packageJson ) , "node_modules/@types" ) ;
338- getCompletionEntriesFromDirectories ( host , typesDir , span , result ) ;
336+ getCompletionEntriesFromDirectories ( typesDir ) ;
339337 }
340338 }
341339
342340 return result ;
343- }
344341
345- function getCompletionEntriesFromDirectories ( host : LanguageServiceHost , directory : string , span : TextSpan , result : Push < CompletionEntry > ) {
346- if ( host . getDirectories && tryDirectoryExists ( host , directory ) ) {
347- const directories = tryGetDirectories ( host , directory ) ;
348- if ( directories ) {
349- for ( let typeDirectory of directories ) {
350- typeDirectory = normalizePath ( typeDirectory ) ;
351- result . push ( createCompletionEntryForModule ( getBaseFileName ( typeDirectory ) , ScriptElementKind . externalModuleName , span ) ) ;
342+ function getCompletionEntriesFromDirectories ( directory : string ) {
343+ Debug . assert ( ! ! host . getDirectories ) ;
344+ if ( tryDirectoryExists ( host , directory ) ) {
345+ const directories = tryGetDirectories ( host , directory ) ;
346+ if ( directories ) {
347+ for ( let typeDirectory of directories ) {
348+ typeDirectory = normalizePath ( typeDirectory ) ;
349+ result . push ( createCompletionEntryForModule ( getBaseFileName ( typeDirectory ) , ScriptElementKind . externalModuleName , span ) ) ;
350+ }
352351 }
353352 }
354353 }
0 commit comments