@@ -94,7 +94,7 @@ namespace ts.Completions.PathCompletions {
9494 *
9595 * both foo.ts and foo.tsx become foo
9696 */
97- const foundFiles = createMap < boolean > ( ) ;
97+ const foundFiles = createMap < true > ( ) ;
9898 for ( let filePath of files ) {
9999 filePath = normalizePath ( filePath ) ;
100100 if ( exclude && comparePaths ( filePath , exclude , scriptPath , ignoreCase ) === Comparison . EqualTo ) {
@@ -103,7 +103,7 @@ namespace ts.Completions.PathCompletions {
103103
104104 const foundFileName = includeExtensions ? getBaseFileName ( filePath ) : removeFileExtension ( getBaseFileName ( filePath ) ) ;
105105
106- if ( ! foundFiles . get ( foundFileName ) ) {
106+ if ( ! foundFiles . has ( foundFileName ) ) {
107107 foundFiles . set ( foundFileName , true ) ;
108108 }
109109 }
@@ -226,8 +226,9 @@ namespace ts.Completions.PathCompletions {
226226 const includeGlob = normalizedSuffix ? "**/*" : "./*" ;
227227
228228 const matches = tryReadDirectory ( host , baseDirectory , fileExtensions , /*exclude*/ undefined , [ includeGlob ] ) ;
229+ const directories = tryGetDirectories ( host , baseDirectory ) ;
229230 // Trim away prefix and suffix
230- return mapDefined ( matches , match => {
231+ return mapDefined ( concatenate ( matches , directories ) , match => {
231232 const normalizedMatch = normalizePath ( match ) ;
232233 if ( ! endsWith ( normalizedMatch , normalizedSuffix ) || ! startsWith ( normalizedMatch , completePrefix ) ) {
233234 return ;
@@ -468,7 +469,7 @@ namespace ts.Completions.PathCompletions {
468469 return tryIOAndConsumeErrors ( host , host . getDirectories , directoryName ) ;
469470 }
470471
471- function tryReadDirectory ( host : LanguageServiceHost , path : string , extensions ?: ReadonlyArray < string > , exclude ?: ReadonlyArray < string > , include ?: ReadonlyArray < string > ) : string [ ] {
472+ function tryReadDirectory ( host : LanguageServiceHost , path : string , extensions ?: ReadonlyArray < string > , exclude ?: ReadonlyArray < string > , include ?: ReadonlyArray < string > ) : string [ ] | undefined {
472473 return tryIOAndConsumeErrors ( host , host . readDirectory , path , extensions , exclude , include ) ;
473474 }
474475
0 commit comments