mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-02 06:21:50 +01:00
Change TextSearchResult API to only return a string relative path to the search folder
This commit is contained in:
@@ -4,12 +4,13 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as path from 'path';
|
||||
import { isFalsyOrEmpty } from 'vs/base/common/arrays';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { values } from 'vs/base/common/map';
|
||||
import URI, { UriComponents } from 'vs/base/common/uri';
|
||||
import { PPromise, TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IFileMatch, ISearchComplete, ISearchProgressItem, ISearchQuery, ISearchResultProvider, ISearchService, QueryType, IRawFileMatch2, ISearchCompleteStats } from 'vs/platform/search/common/search';
|
||||
import { IFileMatch, ISearchComplete, ISearchProgressItem, ISearchQuery, ISearchResultProvider, ISearchService, QueryType, IRawFileMatch2, ISearchCompleteStats, IFolderQuery } from 'vs/platform/search/common/search';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
||||
import { ExtHostContext, ExtHostSearchShape, IExtHostContext, MainContext, MainThreadSearchShape } from '../node/extHost.protocol';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -57,6 +58,7 @@ class SearchOperation {
|
||||
|
||||
constructor(
|
||||
readonly progress: (match: IFileMatch) => any,
|
||||
readonly folders: IFolderQuery[],
|
||||
readonly id: number = ++SearchOperation._idPool,
|
||||
readonly matches = new Map<string, IFileMatch>()
|
||||
) {
|
||||
@@ -110,7 +112,7 @@ class RemoteSearchProvider implements ISearchResultProvider {
|
||||
|
||||
return new PPromise((resolve, reject, report) => {
|
||||
|
||||
const search = new SearchOperation(report);
|
||||
const search = new SearchOperation(report, query.folderQueries);
|
||||
this._searches.set(search.id, search);
|
||||
|
||||
outer = query.type === QueryType.File
|
||||
@@ -140,8 +142,14 @@ class RemoteSearchProvider implements ISearchResultProvider {
|
||||
const searchOp = this._searches.get(session);
|
||||
if (Array.isArray(dataOrUri)) {
|
||||
dataOrUri.forEach(m => {
|
||||
const folderQuery = searchOp.folders[m.resource.folderIdx];
|
||||
if (!folderQuery) {
|
||||
return;
|
||||
}
|
||||
|
||||
const fullUri = URI.file(path.join(folderQuery.folder.fsPath, m.resource.relativePath));
|
||||
searchOp.addMatch({
|
||||
resource: URI.revive(m.resource),
|
||||
resource: fullUri,
|
||||
lineMatches: m.lineMatches
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user