Skip to content

Commit f473dc4

Browse files
committed
Fix missing file search 'rg' log
1 parent 2f0315f commit f473dc4

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

src/vs/workbench/services/search/node/searchService.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { Client, IIPCOptions } from 'vs/base/parts/ipc/node/ipc.cp';
2020
import { IModelService } from 'vs/editor/common/services/modelService';
2121
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
2222
import { IDebugParams, IEnvironmentService } from 'vs/platform/environment/common/environment';
23+
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
2324
import { ILogService } from 'vs/platform/log/common/log';
2425
import { deserializeSearchError, FileMatch, ICachedSearchStats, IFileMatch, IFileQuery, IFileSearchStats, IFolderQuery, IProgress, ISearchComplete, ISearchConfiguration, ISearchEngineStats, ISearchProgressItem, ISearchQuery, ISearchResultProvider, ISearchService, ITextQuery, pathIncludedInQuery, QueryType, SearchError, SearchErrorCode, SearchProviderType } from 'vs/platform/search/common/search';
2526
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
@@ -39,6 +40,7 @@ export class SearchService extends Disposable implements ISearchService {
3940
private readonly fileIndexProviders = new Map<string, ISearchResultProvider>();
4041

4142
constructor(
43+
@IInstantiationService private instantiationService: IInstantiationService,
4244
@IModelService private modelService: IModelService,
4345
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
4446
@IEditorService private editorService: IEditorService,
@@ -49,7 +51,7 @@ export class SearchService extends Disposable implements ISearchService {
4951
@IExtensionService private extensionService: IExtensionService
5052
) {
5153
super();
52-
this.diskSearch = new DiskSearch(!environmentService.isBuilt || environmentService.verbose, /*timeout=*/undefined, environmentService.debugSearch);
54+
this.diskSearch = this.instantiationService.createInstance(DiskSearch, !environmentService.isBuilt || environmentService.verbose, /*timeout=*/undefined, environmentService.debugSearch);
5355
}
5456

5557
public registerSearchResultProvider(scheme: string, type: SearchProviderType, provider: ISearchResultProvider): IDisposable {
@@ -448,9 +450,16 @@ export class SearchService extends Disposable implements ISearchService {
448450
}
449451

450452
export class DiskSearch implements ISearchResultProvider {
453+
public _serviceBrand: any;
454+
451455
private raw: IRawSearchService;
452456

453-
constructor(verboseLogging: boolean, timeout: number = 60 * 60 * 1000, searchDebug?: IDebugParams) {
457+
constructor(
458+
verboseLogging: boolean,
459+
timeout: number = 60 * 60 * 1000,
460+
searchDebug: IDebugParams | undefined,
461+
@ILogService private readonly logService: ILogService
462+
) {
454463
const opts: IIPCOptions = {
455464
serverName: 'Search',
456465
timeout: timeout,
@@ -511,10 +520,20 @@ export class DiskSearch implements ISearchResultProvider {
511520
let event: Event<ISerializedSearchProgressItem | ISerializedSearchComplete>;
512521
event = this.raw.fileSearch(query);
513522

514-
return DiskSearch.collectResultsFromEvent(event, null, token);
523+
const onProgress = (p: ISearchProgressItem) => {
524+
if (p.message) {
525+
// Should only be for logs
526+
this.logService.debug('SearchService#search', p.message);
527+
}
528+
};
529+
530+
return DiskSearch.collectResultsFromEvent(event, onProgress, token);
515531
});
516532
}
517533

534+
/**
535+
* Public for test
536+
*/
518537
public static collectResultsFromEvent(event: Event<ISerializedSearchProgressItem | ISerializedSearchComplete>, onProgress?: (p: ISearchProgressItem) => void, token?: CancellationToken): Promise<ISearchComplete> {
519538
let result: IFileMatch[] = [];
520539

0 commit comments

Comments
 (0)