mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Fix text search type telemetry
This commit is contained in:
parent
f91a845c37
commit
18f1c7c180
|
@ -111,7 +111,7 @@ export class ExtHostSearch implements ExtHostSearchShape {
|
|||
return new TextSearchManager(query, provider, {
|
||||
readdir: resource => Promise.resolve([]), // TODO@rob implement
|
||||
toCanonicalName: encoding => encoding
|
||||
});
|
||||
}, 'textSearchProvider');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import { Schemas } from 'vs/base/common/network';
|
|||
import { URI } from 'vs/base/common/uri';
|
||||
import * as pfs from 'vs/base/node/pfs';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService';
|
||||
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
|
||||
import { ExtHostSearch, reviveQuery } from 'vs/workbench/api/common/extHostSearch';
|
||||
import { IURITransformerService } from 'vs/workbench/api/common/extHostUriTransformerService';
|
||||
|
@ -28,6 +29,7 @@ export class NativeExtHostSearch extends ExtHostSearch {
|
|||
|
||||
constructor(
|
||||
@IExtHostRpcService extHostRpc: IExtHostRpcService,
|
||||
@IExtHostInitDataService initData: IExtHostInitDataService,
|
||||
@IURITransformerService _uriTransformer: IURITransformerService,
|
||||
@ILogService _logService: ILogService,
|
||||
) {
|
||||
|
@ -35,9 +37,16 @@ export class NativeExtHostSearch extends ExtHostSearch {
|
|||
|
||||
const outputChannel = new OutputChannel('RipgrepSearchUD', this._logService);
|
||||
this.registerTextSearchProvider(Schemas.userData, new RipgrepSearchProvider(outputChannel));
|
||||
if (initData.remote.isRemote && initData.remote.authority) {
|
||||
this._registerEHSearchProviders();
|
||||
}
|
||||
}
|
||||
|
||||
override $enableExtensionHostSearch(): void {
|
||||
this._registerEHSearchProviders();
|
||||
}
|
||||
|
||||
private _registerEHSearchProviders(): void {
|
||||
const outputChannel = new OutputChannel('RipgrepSearchEH', this._logService);
|
||||
this.registerTextSearchProvider(Schemas.file, new RipgrepSearchProvider(outputChannel));
|
||||
this.registerInternalFileSearchProvider(Schemas.file, new SearchService('fileSearchProvider'));
|
||||
|
@ -95,6 +104,6 @@ export class NativeExtHostSearch extends ExtHostSearch {
|
|||
}
|
||||
|
||||
protected override createTextSearchManager(query: ITextQuery, provider: vscode.TextSearchProvider): TextSearchManager {
|
||||
return new NativeTextSearchManager(query, provider);
|
||||
return new NativeTextSearchManager(query, provider, undefined, 'textSearchProvider');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import * as path from 'vs/base/common/path';
|
|||
import * as resources from 'vs/base/common/resources';
|
||||
import { isArray, isPromise } from 'vs/base/common/types';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IExtendedExtensionSearchOptions, IFileMatch, IFolderQuery, IPatternInfo, ISearchCompleteStats, ITextQuery, ITextSearchContext, ITextSearchMatch, ITextSearchResult, QueryGlobTester, resolvePatternsForProvider } from 'vs/workbench/services/search/common/search';
|
||||
import { IExtendedExtensionSearchOptions, IFileMatch, IFolderQuery, IPatternInfo, ISearchCompleteStats, ITextQuery, ITextSearchContext, ITextSearchMatch, ITextSearchResult, ITextSearchStats, QueryGlobTester, resolvePatternsForProvider } from 'vs/workbench/services/search/common/search';
|
||||
import { Range, TextSearchComplete, TextSearchMatch, TextSearchOptions, TextSearchProvider, TextSearchQuery, TextSearchResult } from 'vs/workbench/services/search/common/searchExtTypes';
|
||||
|
||||
export interface IFileUtils {
|
||||
|
@ -27,7 +27,7 @@ export class TextSearchManager {
|
|||
private isLimitHit = false;
|
||||
private resultCount = 0;
|
||||
|
||||
constructor(private query: ITextQuery, private provider: TextSearchProvider, private fileUtils: IFileUtils) { }
|
||||
constructor(private query: ITextQuery, private provider: TextSearchProvider, private fileUtils: IFileUtils, private processType: ITextSearchStats['type']) { }
|
||||
|
||||
search(onProgress: (matches: IFileMatch[]) => void, token: CancellationToken): Promise<ISearchCompleteStats> {
|
||||
const folderQueries = this.query.folderQueries || [];
|
||||
|
@ -77,7 +77,7 @@ export class TextSearchManager {
|
|||
else { return [result.message]; }
|
||||
})),
|
||||
stats: {
|
||||
type: 'textSearchProvider'
|
||||
type: this.processType
|
||||
}
|
||||
});
|
||||
}, (err: Error) => {
|
||||
|
|
|
@ -5,16 +5,16 @@
|
|||
|
||||
import { toCanonicalName } from 'vs/workbench/services/textfile/common/encoding';
|
||||
import * as pfs from 'vs/base/node/pfs';
|
||||
import { ITextQuery } from 'vs/workbench/services/search/common/search';
|
||||
import { ITextQuery, ITextSearchStats } from 'vs/workbench/services/search/common/search';
|
||||
import { TextSearchProvider } from 'vs/workbench/services/search/common/searchExtTypes';
|
||||
import { TextSearchManager } from 'vs/workbench/services/search/common/textSearchManager';
|
||||
|
||||
export class NativeTextSearchManager extends TextSearchManager {
|
||||
|
||||
constructor(query: ITextQuery, provider: TextSearchProvider, _pfs: typeof pfs = pfs) {
|
||||
constructor(query: ITextQuery, provider: TextSearchProvider, _pfs: typeof pfs = pfs, processType: ITextSearchStats['type'] = 'searchProcess') {
|
||||
super(query, provider, {
|
||||
readdir: resource => _pfs.Promises.readdir(resource.fsPath),
|
||||
toCanonicalName: name => toCanonicalName(name)
|
||||
});
|
||||
}, processType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,10 @@ import { DisposableStore } from 'vs/base/common/lifecycle';
|
|||
import { joinPath } from 'vs/base/common/resources';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import * as pfs from 'vs/base/node/pfs';
|
||||
import { mock } from 'vs/base/test/common/mock';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import { MainContext, MainThreadSearchShape } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService';
|
||||
import { Range } from 'vs/workbench/api/common/extHostTypes';
|
||||
import { URITransformerService } from 'vs/workbench/api/common/extHostUriTransformerService';
|
||||
import { NativeExtHostSearch } from 'vs/workbench/api/node/extHostSearch';
|
||||
|
@ -139,6 +141,7 @@ suite('ExtHostSearch', () => {
|
|||
constructor() {
|
||||
super(
|
||||
rpcProtocol,
|
||||
new class extends mock<IExtHostInitDataService>() { override remote = { isRemote: false, authority: undefined, connectionData: null }; },
|
||||
new URITransformerService(null),
|
||||
logService
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue