@@ -90,23 +90,6 @@ namespace ts {
9090 }
9191 }
9292
93- function readDirectory ( folder : FSEntry , ext : string , excludes : Path [ ] , result : string [ ] ) : void {
94- if ( ! folder || ! isFolder ( folder ) || contains ( excludes , folder . path ) ) {
95- return ;
96- }
97- for ( const entry of folder . entries ) {
98- if ( contains ( excludes , entry . path ) ) {
99- continue ;
100- }
101- if ( isFolder ( entry ) ) {
102- readDirectory ( entry , ext , excludes , result ) ;
103- }
104- else if ( fileExtensionIs ( entry . path , ext ) ) {
105- result . push ( entry . fullPath ) ;
106- }
107- }
108- }
109-
11093 function checkNumberOfConfiguredProjects ( projectService : server . ProjectService , expected : number ) {
11194 assert . equal ( projectService . configuredProjects . length , expected , `expected ${ expected } configured project(s)` ) ;
11295 }
@@ -188,10 +171,26 @@ namespace ts {
188171 }
189172 }
190173
191- readDirectory ( path : string , ext : string , excludes : string [ ] ) : string [ ] {
192- const result : string [ ] = [ ] ;
193- readDirectory ( this . fs . get ( this . toPath ( path ) ) , ext , map ( excludes , e => toPath ( e , path , this . getCanonicalFileName ) ) , result ) ;
194- return result ;
174+ readDirectory ( path : string , extensions ?: string [ ] , exclude ?: string [ ] , include ?: string [ ] ) : string [ ] {
175+ const that = this ;
176+ return ts . matchFiles ( path , extensions , exclude , include , this . useCaseSensitiveFileNames , this . getCurrentDirectory ( ) , ( dir ) => {
177+ const result : FileSystemEntries = {
178+ directories : [ ] ,
179+ files : [ ]
180+ } ;
181+ const dirEntry = that . fs . get ( that . toPath ( dir ) ) ;
182+ if ( isFolder ( dirEntry ) ) {
183+ dirEntry . entries . forEach ( ( entry ) => {
184+ if ( isFolder ( entry ) ) {
185+ result . directories . push ( entry . fullPath ) ;
186+ }
187+ else if ( isFile ( entry ) ) {
188+ result . files . push ( entry . fullPath ) ;
189+ }
190+ } ) ;
191+ }
192+ return result ;
193+ } ) ;
195194 }
196195
197196 watchDirectory ( directoryName : string , callback : DirectoryWatcherCallback , recursive : boolean ) : DirectoryWatcher {
0 commit comments