@@ -31,7 +31,7 @@ export class SearchService implements ISearchService {
3131 public _serviceBrand : any ;
3232
3333 private diskSearch : DiskSearch ;
34- private readonly searchProvider : ISearchResultProvider [ ] = [ ] ;
34+ private readonly searchProviders : ISearchResultProvider [ ] = [ ] ;
3535 private forwardingTelemetry : PPromise < void , ITelemetryEvent > ;
3636
3737 constructor (
@@ -47,12 +47,12 @@ export class SearchService implements ISearchService {
4747 }
4848
4949 public registerSearchResultProvider ( provider : ISearchResultProvider ) : IDisposable {
50- this . searchProvider . push ( provider ) ;
50+ this . searchProviders . push ( provider ) ;
5151 return {
5252 dispose : ( ) => {
53- const idx = this . searchProvider . indexOf ( provider ) ;
53+ const idx = this . searchProviders . indexOf ( provider ) ;
5454 if ( idx >= 0 ) {
55- this . searchProvider . splice ( idx , 1 ) ;
55+ this . searchProviders . splice ( idx , 1 ) ;
5656 }
5757 }
5858 } ;
@@ -114,40 +114,37 @@ export class SearchService implements ISearchService {
114114 }
115115 } ) ;
116116
117- const enableSearchProviders = this . configurationService . getValue < ISearchConfiguration > ( ) . search . enableSearchProviders ;
118- const providerPromise = enableSearchProviders ?
119- this . extensionService . whenInstalledExtensionsRegistered ( ) . then ( ( ) => {
120- // If no search providers are registered, fall back on DiskSearch
121- // TODO@roblou this is not properly waiting for search-rg to finish registering itself
122- if ( this . searchProvider . length ) {
123- return TPromise . join ( this . searchProvider . map ( p => searchWithProvider ( p ) ) )
124- . then ( completes => {
125- completes = completes . filter ( c => ! ! c ) ;
126- if ( ! completes . length ) {
127- return null ;
128- }
129-
130- return < ISearchComplete > {
131- limitHit : completes [ 0 ] && completes [ 0 ] . limitHit ,
132- stats : completes [ 0 ] . stats ,
133- results : arrays . flatten ( completes . map ( c => c . results ) )
134- } ;
135- } , errs => {
136- if ( ! Array . isArray ( errs ) ) {
137- errs = [ errs ] ;
138- }
139-
140- errs = errs . filter ( e => ! ! e ) ;
141- return TPromise . wrapError ( errs [ 0 ] ) ;
142- } ) ;
143- } else {
144- return searchWithProvider ( this . diskSearch ) ;
145- }
146- } ) :
147- searchWithProvider ( this . diskSearch ) ;
117+ const providerPromise = this . extensionService . whenInstalledExtensionsRegistered ( ) . then ( ( ) => {
118+ // If no search providers are registered, fall back on DiskSearch
119+ // TODO@roblou this is not properly waiting for search-rg to finish registering itself
120+ if ( this . searchProviders . length ) {
121+ return TPromise . join ( this . searchProviders . map ( p => searchWithProvider ( p ) ) )
122+ . then ( completes => {
123+ completes = completes . filter ( c => ! ! c ) ;
124+ if ( ! completes . length ) {
125+ return null ;
126+ }
127+
128+ return < ISearchComplete > {
129+ limitHit : completes [ 0 ] && completes [ 0 ] . limitHit ,
130+ stats : completes [ 0 ] . stats ,
131+ results : arrays . flatten ( completes . map ( c => c . results ) )
132+ } ;
133+ } , errs => {
134+ if ( ! Array . isArray ( errs ) ) {
135+ errs = [ errs ] ;
136+ }
137+
138+ errs = errs . filter ( e => ! ! e ) ;
139+ return TPromise . wrapError ( errs [ 0 ] ) ;
140+ } ) ;
141+ } else {
142+ return searchWithProvider ( this . diskSearch ) ;
143+ }
144+ } ) ;
148145
149146 combinedPromise = providerPromise . then ( value => {
150- this . logService . debug ( `SearchService#search took ${ Date . now ( ) - startTime } ms ${ enableSearchProviders ? 'with' : 'without' } search-rg ` ) ;
147+ this . logService . debug ( `SearchService#search: ${ Date . now ( ) - startTime } ms` ) ;
151148 const values = [ value ] ;
152149
153150 const result : ISearchComplete = {
0 commit comments