VSCode merge (#4610)

* Merge from vscode e388c734f30757875976c7e326d6cfeee77710de

* fix yarn lcoks

* remove small issue
This commit is contained in:
Anthony Dresser
2019-03-20 10:39:09 -07:00
committed by GitHub
parent 87765e8673
commit c814b92557
310 changed files with 6606 additions and 2129 deletions

View File

@@ -29,6 +29,7 @@ import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/un
import { SearchChannelClient } from './searchIpc';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
export class SearchService extends Disposable implements ISearchService {
_serviceBrand: any;
@@ -176,7 +177,7 @@ export class SearchService extends Disposable implements ISearchService {
const fqs = this.groupFolderQueriesByScheme(query);
keys(fqs).forEach(scheme => {
const schemeFQs = fqs.get(scheme);
const schemeFQs = fqs.get(scheme)!;
const provider = query.type === QueryType.File ?
this.fileSearchProviders.get(scheme) :
this.textSearchProviders.get(scheme);
@@ -226,7 +227,7 @@ export class SearchService extends Disposable implements ISearchService {
const endToEndTime = e2eSW.elapsed();
this.logService.trace(`SearchService#search: ${endToEndTime}ms`);
const searchError = deserializeSearchError(err.message);
this.sendTelemetry(query, endToEndTime, null, searchError);
this.sendTelemetry(query, endToEndTime, undefined, searchError);
throw searchError;
});
@@ -352,8 +353,8 @@ export class SearchService extends Disposable implements ISearchService {
}
}
private getLocalResults(query: ITextQuery): ResourceMap<IFileMatch> {
const localResults = new ResourceMap<IFileMatch>();
private getLocalResults(query: ITextQuery): ResourceMap<IFileMatch | null> {
const localResults = new ResourceMap<IFileMatch | null>();
if (query.type === QueryType.Text) {
const models = this.modelService.getModels();
@@ -374,11 +375,8 @@ export class SearchService extends Disposable implements ISearchService {
}
}
// Don't support other resource schemes than files for now
// todo@remote
// why is that? we should search for resources from other
// schemes
else if (resource.scheme !== Schemas.file) {
// Block walkthrough, webview, etc.
else if (resource.scheme !== Schemas.file && resource.scheme !== REMOTE_HOST_SCHEME) {
return;
}
@@ -387,7 +385,7 @@ export class SearchService extends Disposable implements ISearchService {
}
// Use editor API to find matches
const matches = model.findMatches(query.contentPattern.pattern, false, query.contentPattern.isRegExp, query.contentPattern.isCaseSensitive, query.contentPattern.isWordMatch ? query.contentPattern.wordSeparators : null, false, query.maxResults);
const matches = model.findMatches(query.contentPattern.pattern, false, !!query.contentPattern.isRegExp, !!query.contentPattern.isCaseSensitive, query.contentPattern.isWordMatch ? query.contentPattern.wordSeparators! : null, false, query.maxResults);
if (matches.length) {
const fileMatch = new FileMatch(resource);
localResults.set(resource, fileMatch);
@@ -583,4 +581,4 @@ export class DiskSearch implements ISearchResultProvider {
}
}
registerSingleton(ISearchService, SearchService, true);
registerSingleton(ISearchService, SearchService, true);

View File

@@ -39,7 +39,7 @@ export class TextSearchEngineAdapter {
},
token)
.then(
c => resolve({ limitHit: c.limitHit, stats: null, type: 'success' } as ISerializedSearchSuccess),
c => resolve({ limitHit: c.limitHit, type: 'success' } as ISerializedSearchSuccess),
reject);
});
}
@@ -47,7 +47,7 @@ export class TextSearchEngineAdapter {
function fileMatchToSerialized(match: IFileMatch): ISerializedFileMatch {
return {
path: match.resource ? match.resource.fsPath : undefined,
path: match.resource && match.resource.fsPath,
results: match.results,
numMatches: (match.results || []).reduce((sum, r) => {
if (!!(<ITextSearchMatch>r).ranges) {