@@ -94,7 +94,7 @@ namespace ts.Completions.PathCompletions {
94
94
*
95
95
* both foo.ts and foo.tsx become foo
96
96
*/
97
- const foundFiles = createMap < boolean > ( ) ;
97
+ const foundFiles = createMap < true > ( ) ;
98
98
for ( let filePath of files ) {
99
99
filePath = normalizePath ( filePath ) ;
100
100
if ( exclude && comparePaths ( filePath , exclude , scriptPath , ignoreCase ) === Comparison . EqualTo ) {
@@ -103,7 +103,7 @@ namespace ts.Completions.PathCompletions {
103
103
104
104
const foundFileName = includeExtensions ? getBaseFileName ( filePath ) : removeFileExtension ( getBaseFileName ( filePath ) ) ;
105
105
106
- if ( ! foundFiles . get ( foundFileName ) ) {
106
+ if ( ! foundFiles . has ( foundFileName ) ) {
107
107
foundFiles . set ( foundFileName , true ) ;
108
108
}
109
109
}
@@ -226,8 +226,9 @@ namespace ts.Completions.PathCompletions {
226
226
const includeGlob = normalizedSuffix ? "**/*" : "./*" ;
227
227
228
228
const matches = tryReadDirectory ( host , baseDirectory , fileExtensions , /*exclude*/ undefined , [ includeGlob ] ) ;
229
+ const directories = tryGetDirectories ( host , baseDirectory ) ;
229
230
// Trim away prefix and suffix
230
- return mapDefined ( matches , match => {
231
+ return mapDefined ( concatenate ( matches , directories ) , match => {
231
232
const normalizedMatch = normalizePath ( match ) ;
232
233
if ( ! endsWith ( normalizedMatch , normalizedSuffix ) || ! startsWith ( normalizedMatch , completePrefix ) ) {
233
234
return ;
@@ -468,7 +469,7 @@ namespace ts.Completions.PathCompletions {
468
469
return tryIOAndConsumeErrors ( host , host . getDirectories , directoryName ) ;
469
470
}
470
471
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 {
472
473
return tryIOAndConsumeErrors ( host , host . readDirectory , path , extensions , exclude , include ) ;
473
474
}
474
475
0 commit comments