mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-10 10:12:34 -05:00
Merge from vscode 2b0b9136329c181a9e381463a1f7dc3a2d105a34 (#4880)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { mapArrayOrNot } from 'vs/base/common/arrays';
|
||||
import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
@@ -9,12 +10,11 @@ import { isPromiseCanceledError } from 'vs/base/common/errors';
|
||||
import { dispose } from 'vs/base/common/lifecycle';
|
||||
import { joinPath } from 'vs/base/common/resources';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import * as extfs from 'vs/base/node/extfs';
|
||||
import { IFileMatch, IFileQuery, IPatternInfo, IRawFileMatch2, ISearchCompleteStats, ISearchQuery, ITextQuery, QueryType, resultIsMatch } from 'vs/workbench/services/search/common/search';
|
||||
import * as pfs from 'vs/base/node/pfs';
|
||||
import { MainContext, MainThreadSearchShape } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { ExtHostSearch } from 'vs/workbench/api/node/extHostSearch';
|
||||
import { Range } from 'vs/workbench/api/node/extHostTypes';
|
||||
import { extensionResultIsMatch } from 'vs/workbench/services/search/node/textSearchManager';
|
||||
import { IFileMatch, IFileQuery, IPatternInfo, IRawFileMatch2, ISearchCompleteStats, ISearchQuery, ITextQuery, QueryType, resultIsMatch } from 'vs/workbench/services/search/common/search';
|
||||
import { TestRPCProtocol } from 'vs/workbench/test/electron-browser/api/testRPCProtocol';
|
||||
import { TestLogService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import * as vscode from 'vscode';
|
||||
@@ -55,7 +55,11 @@ class MockMainThreadSearch implements MainThreadSearchShape {
|
||||
}
|
||||
}
|
||||
|
||||
let mockExtfs: Partial<typeof extfs>;
|
||||
let mockPFS: Partial<typeof pfs>;
|
||||
|
||||
export function extensionResultIsMatch(data: vscode.TextSearchResult): data is vscode.TextSearchMatch {
|
||||
return !!(<vscode.TextSearchMatch>data).preview;
|
||||
}
|
||||
|
||||
suite('ExtHostSearch', () => {
|
||||
async function registerTestTextSearchProvider(provider: vscode.TextSearchProvider, scheme = 'file'): Promise<void> {
|
||||
@@ -130,8 +134,8 @@ suite('ExtHostSearch', () => {
|
||||
|
||||
rpcProtocol.set(MainContext.MainThreadSearch, mockMainThreadSearch);
|
||||
|
||||
mockExtfs = {};
|
||||
extHostSearch = new ExtHostSearch(rpcProtocol, null!, logService, mockExtfs as typeof extfs);
|
||||
mockPFS = {};
|
||||
extHostSearch = new ExtHostSearch(rpcProtocol, null!, logService, mockPFS as any);
|
||||
});
|
||||
|
||||
teardown(() => {
|
||||
@@ -856,14 +860,14 @@ suite('ExtHostSearch', () => {
|
||||
});
|
||||
|
||||
test('basic sibling clause', async () => {
|
||||
mockExtfs.readdir = (_path: string, callback: (error: Error, files: string[]) => void) => {
|
||||
mockPFS.readdir = (_path: string) => {
|
||||
if (_path === rootFolderA.fsPath) {
|
||||
callback(null!, [
|
||||
return Promise.resolve([
|
||||
'file1.js',
|
||||
'file1.ts'
|
||||
]);
|
||||
} else {
|
||||
callback(new Error('Wrong path'), null!);
|
||||
return Promise.reject(new Error('Wrong path'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -899,21 +903,21 @@ suite('ExtHostSearch', () => {
|
||||
});
|
||||
|
||||
test('multiroot sibling clause', async () => {
|
||||
mockExtfs.readdir = (_path: string, callback: (error: Error, files: string[]) => void) => {
|
||||
mockPFS.readdir = (_path: string) => {
|
||||
if (_path === joinPath(rootFolderA, 'folder').fsPath) {
|
||||
callback(null!, [
|
||||
return Promise.resolve([
|
||||
'fileA.scss',
|
||||
'fileA.css',
|
||||
'file2.css'
|
||||
]);
|
||||
} else if (_path === rootFolderB.fsPath) {
|
||||
callback(null!, [
|
||||
return Promise.resolve([
|
||||
'fileB.ts',
|
||||
'fileB.js',
|
||||
'file3.js'
|
||||
]);
|
||||
} else {
|
||||
callback(new Error('Wrong path'), null!);
|
||||
return Promise.reject(new Error('Wrong path'));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import { TestInstantiationService } from 'vs/platform/instantiation/test/common/
|
||||
import { MainThreadConfiguration } from 'vs/workbench/api/browser/mainThreadConfiguration';
|
||||
import { SingleProxyRPCProtocol } from './testRPCProtocol';
|
||||
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
import { WorkspaceService } from 'vs/workbench/services/configuration/node/configurationService';
|
||||
import { WorkspaceService } from 'vs/workbench/services/configuration/browser/configurationService';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
|
||||
suite('MainThreadConfiguration', function () {
|
||||
|
||||
Reference in New Issue
Block a user