Skip to content

Commit f692972

Browse files
author
Benjamin Pasero
committed
debt - move fileSearchManager to common (for microsoft#84106)
1 parent 768399b commit f692972

2 files changed

Lines changed: 14 additions & 13 deletions

File tree

src/vs/workbench/api/node/extHostSearch.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { URI, UriComponents } from 'vs/base/common/uri';
99
import * as pfs from 'vs/base/node/pfs';
1010
import { ILogService } from 'vs/platform/log/common/log';
1111
import { IFileQuery, IFolderQuery, IRawFileQuery, IRawQuery, IRawTextQuery, ISearchCompleteStats, ITextQuery, isSerializedFileMatch, ISerializedSearchProgressItem } from 'vs/workbench/services/search/common/search';
12-
import { FileSearchManager } from 'vs/workbench/services/search/node/fileSearchManager';
12+
import { FileSearchManager } from 'vs/workbench/services/search/common/fileSearchManager';
1313
import { SearchService } from 'vs/workbench/services/search/node/rawSearchService';
1414
import { RipgrepSearchProvider } from 'vs/workbench/services/search/node/ripgrepSearchProvider';
1515
import { OutputChannel } from 'vs/workbench/services/search/node/ripgrepSearchUtils';
@@ -56,6 +56,17 @@ export class ExtHostSearch implements ExtHostSearchShape {
5656
this.registerInternalFileSearchProvider('file', new SearchService());
5757
}
5858

59+
private registerInternalFileSearchProvider(scheme: string, provider: SearchService): IDisposable {
60+
const handle = this._handlePool++;
61+
this._internalFileSearchProvider = provider;
62+
this._internalFileSearchHandle = handle;
63+
this._proxy.$registerFileSearchProvider(handle, this._transformScheme(scheme));
64+
return toDisposable(() => {
65+
this._internalFileSearchProvider = null;
66+
this._proxy.$unregisterProvider(handle);
67+
});
68+
}
69+
5970
private _transformScheme(scheme: string): string {
6071
return this._uriTransformer.transformOutgoingScheme(scheme);
6172
}
@@ -92,17 +103,6 @@ export class ExtHostSearch implements ExtHostSearchShape {
92103
});
93104
}
94105

95-
registerInternalFileSearchProvider(scheme: string, provider: SearchService): IDisposable {
96-
const handle = this._handlePool++;
97-
this._internalFileSearchProvider = provider;
98-
this._internalFileSearchHandle = handle;
99-
this._proxy.$registerFileSearchProvider(handle, this._transformScheme(scheme));
100-
return toDisposable(() => {
101-
this._internalFileSearchProvider = null;
102-
this._proxy.$unregisterProvider(handle);
103-
});
104-
}
105-
106106
$provideFileSearchResults(handle: number, session: number, rawQuery: IRawFileQuery, token: CancellationToken): Promise<ISearchCompleteStats> {
107107
const query = reviveQuery(rawQuery);
108108
if (handle === this._internalFileSearchHandle) {

src/vs/workbench/services/search/node/fileSearchManager.ts renamed to src/vs/workbench/services/search/common/fileSearchManager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { StopWatch } from 'vs/base/common/stopwatch';
1212
import { URI } from 'vs/base/common/uri';
1313
import { IFileMatch, IFileSearchProviderStats, IFolderQuery, ISearchCompleteStats, IFileQuery, QueryGlobTester, resolvePatternsForProvider } from 'vs/workbench/services/search/common/search';
1414
import { FileSearchProvider, FileSearchOptions } from 'vs/workbench/services/search/common/searchExtTypes';
15+
import { nextTick } from 'vs/base/common/process';
1516

1617
export interface IInternalFileMatch {
1718
base: URI;
@@ -114,7 +115,7 @@ class FileSearchEngine {
114115
const noSiblingsClauses = !queryTester.hasSiblingExcludeClauses();
115116

116117
let providerSW: StopWatch;
117-
new Promise(_resolve => process.nextTick(_resolve))
118+
new Promise(_resolve => nextTick(_resolve))
118119
.then(() => {
119120
this.activeCancellationTokens.add(cancellation);
120121

0 commit comments

Comments
 (0)