mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-10 10:12:34 -05:00
Merge from vscode a348d103d1256a06a2c9b3f9b406298a9fef6898 (#15681)
* Merge from vscode a348d103d1256a06a2c9b3f9b406298a9fef6898 * Fixes and cleanup * Distro * Fix hygiene yarn * delete no yarn lock changes file * Fix hygiene * Fix layer check * Fix CI * Skip lib checks * Remove tests deleted in vs code * Fix tests * Distro * Fix tests and add removed extension point * Skip failing notebook tests for now * Disable broken tests and cleanup build folder * Update yarn.lock and fix smoke tests * Bump sqlite * fix contributed actions and file spacing * Fix user data path * Update yarn.locks Co-authored-by: ADS Merger <karlb@microsoft.com>
This commit is contained in:
@@ -23,6 +23,7 @@ import { mock } from 'vs/base/test/common/mock';
|
||||
import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService';
|
||||
import { TextSearchManager } from 'vs/workbench/services/search/common/textSearchManager';
|
||||
import { NativeTextSearchManager } from 'vs/workbench/services/search/node/textSearchManager';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
|
||||
let rpcProtocol: TestRPCProtocol;
|
||||
let extHostSearch: NativeExtHostSearch;
|
||||
@@ -83,7 +84,7 @@ suite('ExtHostSearch', () => {
|
||||
const cancellation = new CancellationTokenSource();
|
||||
const p = extHostSearch.$provideFileSearchResults(mockMainThreadSearch.lastHandle, 0, query, cancellation.token);
|
||||
if (cancel) {
|
||||
await new Promise(resolve => process.nextTick(resolve));
|
||||
await timeout(0);
|
||||
cancellation.cancel();
|
||||
}
|
||||
|
||||
@@ -102,15 +103,11 @@ suite('ExtHostSearch', () => {
|
||||
};
|
||||
}
|
||||
|
||||
async function runTextSearch(query: ITextQuery, cancel = false): Promise<{ results: IFileMatch[], stats: ISearchCompleteStats }> {
|
||||
async function runTextSearch(query: ITextQuery): Promise<{ results: IFileMatch[], stats: ISearchCompleteStats }> {
|
||||
let stats: ISearchCompleteStats;
|
||||
try {
|
||||
const cancellation = new CancellationTokenSource();
|
||||
const p = extHostSearch.$provideTextSearchResults(mockMainThreadSearch.lastHandle, 0, query, cancellation.token);
|
||||
if (cancel) {
|
||||
await new Promise(resolve => process.nextTick(resolve));
|
||||
cancellation.cancel();
|
||||
}
|
||||
|
||||
stats = await p;
|
||||
} catch (err) {
|
||||
@@ -151,7 +148,7 @@ suite('ExtHostSearch', () => {
|
||||
this._pfs = mockPFS as any;
|
||||
}
|
||||
|
||||
protected createTextSearchManager(query: ITextQuery, provider: vscode.TextSearchProvider): TextSearchManager {
|
||||
protected override createTextSearchManager(query: ITextQuery, provider: vscode.TextSearchProvider): TextSearchManager {
|
||||
return new NativeTextSearchManager(query, provider, this._pfs);
|
||||
}
|
||||
};
|
||||
@@ -183,7 +180,7 @@ suite('ExtHostSearch', () => {
|
||||
function compareURIs(actual: URI[], expected: URI[]) {
|
||||
const sortAndStringify = (arr: URI[]) => arr.sort().map(u => u.toString());
|
||||
|
||||
assert.deepEqual(
|
||||
assert.deepStrictEqual(
|
||||
sortAndStringify(actual),
|
||||
sortAndStringify(expected));
|
||||
}
|
||||
@@ -215,7 +212,7 @@ suite('ExtHostSearch', () => {
|
||||
|
||||
const { results, stats } = await runFileSearch(getSimpleQuery());
|
||||
assert(!stats.limitHit);
|
||||
assert.equal(results.length, 3);
|
||||
assert.strictEqual(results.length, 3);
|
||||
compareURIs(results, reportedResults);
|
||||
});
|
||||
|
||||
@@ -223,12 +220,19 @@ suite('ExtHostSearch', () => {
|
||||
let cancelRequested = false;
|
||||
await registerTestFileSearchProvider({
|
||||
provideFileSearchResults(query: vscode.FileSearchQuery, options: vscode.FileSearchOptions, token: vscode.CancellationToken): Promise<URI[]> {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
token.onCancellationRequested(() => {
|
||||
function onCancel() {
|
||||
cancelRequested = true;
|
||||
|
||||
resolve([joinPath(options.folder, 'file1.ts')]); // or reject or nothing?
|
||||
});
|
||||
}
|
||||
|
||||
if (token.isCancellationRequested) {
|
||||
onCancel();
|
||||
} else {
|
||||
token.onCancellationRequested(() => onCancel());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -286,11 +290,11 @@ suite('ExtHostSearch', () => {
|
||||
await registerTestFileSearchProvider({
|
||||
provideFileSearchResults(query: vscode.FileSearchQuery, options: vscode.FileSearchOptions, token: vscode.CancellationToken): Promise<URI[]> {
|
||||
if (options.folder.toString() === rootFolderA.toString()) {
|
||||
assert.deepEqual(options.includes.sort(), ['*.ts', 'foo']);
|
||||
assert.deepEqual(options.excludes.sort(), ['*.js', 'bar']);
|
||||
assert.deepStrictEqual(options.includes.sort(), ['*.ts', 'foo']);
|
||||
assert.deepStrictEqual(options.excludes.sort(), ['*.js', 'bar']);
|
||||
} else {
|
||||
assert.deepEqual(options.includes.sort(), ['*.ts']);
|
||||
assert.deepEqual(options.excludes.sort(), ['*.js']);
|
||||
assert.deepStrictEqual(options.includes.sort(), ['*.ts']);
|
||||
assert.deepStrictEqual(options.excludes.sort(), ['*.js']);
|
||||
}
|
||||
|
||||
return Promise.resolve(null!);
|
||||
@@ -327,8 +331,8 @@ suite('ExtHostSearch', () => {
|
||||
test('include/excludes resolved correctly', async () => {
|
||||
await registerTestFileSearchProvider({
|
||||
provideFileSearchResults(query: vscode.FileSearchQuery, options: vscode.FileSearchOptions, token: vscode.CancellationToken): Promise<URI[]> {
|
||||
assert.deepEqual(options.includes.sort(), ['*.jsx', '*.ts']);
|
||||
assert.deepEqual(options.excludes.sort(), []);
|
||||
assert.deepStrictEqual(options.includes.sort(), ['*.jsx', '*.ts']);
|
||||
assert.deepStrictEqual(options.excludes.sort(), []);
|
||||
|
||||
return Promise.resolve(null!);
|
||||
}
|
||||
@@ -492,7 +496,7 @@ suite('ExtHostSearch', () => {
|
||||
|
||||
const { results, stats } = await runFileSearch(query);
|
||||
assert(stats.limitHit, 'Expected to return limitHit');
|
||||
assert.equal(results.length, 1);
|
||||
assert.strictEqual(results.length, 1);
|
||||
compareURIs(results, reportedResults.slice(0, 1));
|
||||
assert(wasCanceled, 'Expected to be canceled when hitting limit');
|
||||
});
|
||||
@@ -528,7 +532,7 @@ suite('ExtHostSearch', () => {
|
||||
|
||||
const { results, stats } = await runFileSearch(query);
|
||||
assert(stats.limitHit, 'Expected to return limitHit');
|
||||
assert.equal(results.length, 2);
|
||||
assert.strictEqual(results.length, 2);
|
||||
compareURIs(results, reportedResults.slice(0, 2));
|
||||
assert(wasCanceled, 'Expected to be canceled when hitting limit');
|
||||
});
|
||||
@@ -563,7 +567,7 @@ suite('ExtHostSearch', () => {
|
||||
|
||||
const { results, stats } = await runFileSearch(query);
|
||||
assert(!stats.limitHit, 'Expected not to return limitHit');
|
||||
assert.equal(results.length, 2);
|
||||
assert.strictEqual(results.length, 2);
|
||||
compareURIs(results, reportedResults);
|
||||
assert(!wasCanceled, 'Expected not to be canceled when just reaching limit');
|
||||
});
|
||||
@@ -601,8 +605,8 @@ suite('ExtHostSearch', () => {
|
||||
};
|
||||
|
||||
const { results } = await runFileSearch(query);
|
||||
assert.equal(results.length, 2); // Don't care which 2 we got
|
||||
assert.equal(cancels, 2, 'Expected all invocations to be canceled when hitting limit');
|
||||
assert.strictEqual(results.length, 2); // Don't care which 2 we got
|
||||
assert.strictEqual(cancels, 2, 'Expected all invocations to be canceled when hitting limit');
|
||||
});
|
||||
|
||||
test('works with non-file schemes', async () => {
|
||||
@@ -713,12 +717,12 @@ suite('ExtHostSearch', () => {
|
||||
match: null // Don't care about this right now
|
||||
}
|
||||
} : {
|
||||
uri: r.uri.toString(),
|
||||
text: r.text,
|
||||
lineNumber: r.lineNumber
|
||||
});
|
||||
uri: r.uri.toString(),
|
||||
text: r.text,
|
||||
lineNumber: r.lineNumber
|
||||
});
|
||||
|
||||
return assert.deepEqual(
|
||||
return assert.deepStrictEqual(
|
||||
makeComparable(actualTextSearchResults),
|
||||
makeComparable(expected));
|
||||
}
|
||||
@@ -756,8 +760,8 @@ suite('ExtHostSearch', () => {
|
||||
test('all provider calls get global include/excludes', async () => {
|
||||
await registerTestTextSearchProvider({
|
||||
provideTextSearchResults(query: vscode.TextSearchQuery, options: vscode.TextSearchOptions, progress: vscode.Progress<vscode.TextSearchResult>, token: vscode.CancellationToken): Promise<vscode.TextSearchComplete> {
|
||||
assert.equal(options.includes.length, 1);
|
||||
assert.equal(options.excludes.length, 1);
|
||||
assert.strictEqual(options.includes.length, 1);
|
||||
assert.strictEqual(options.excludes.length, 1);
|
||||
return Promise.resolve(null!);
|
||||
}
|
||||
});
|
||||
@@ -787,11 +791,11 @@ suite('ExtHostSearch', () => {
|
||||
await registerTestTextSearchProvider({
|
||||
provideTextSearchResults(query: vscode.TextSearchQuery, options: vscode.TextSearchOptions, progress: vscode.Progress<vscode.TextSearchResult>, token: vscode.CancellationToken): Promise<vscode.TextSearchComplete> {
|
||||
if (options.folder.toString() === rootFolderA.toString()) {
|
||||
assert.deepEqual(options.includes.sort(), ['*.ts', 'foo']);
|
||||
assert.deepEqual(options.excludes.sort(), ['*.js', 'bar']);
|
||||
assert.deepStrictEqual(options.includes.sort(), ['*.ts', 'foo']);
|
||||
assert.deepStrictEqual(options.excludes.sort(), ['*.js', 'bar']);
|
||||
} else {
|
||||
assert.deepEqual(options.includes.sort(), ['*.ts']);
|
||||
assert.deepEqual(options.excludes.sort(), ['*.js']);
|
||||
assert.deepStrictEqual(options.includes.sort(), ['*.ts']);
|
||||
assert.deepStrictEqual(options.excludes.sort(), ['*.js']);
|
||||
}
|
||||
|
||||
return Promise.resolve(null!);
|
||||
@@ -828,8 +832,8 @@ suite('ExtHostSearch', () => {
|
||||
test('include/excludes resolved correctly', async () => {
|
||||
await registerTestTextSearchProvider({
|
||||
provideTextSearchResults(query: vscode.TextSearchQuery, options: vscode.TextSearchOptions, progress: vscode.Progress<vscode.TextSearchResult>, token: vscode.CancellationToken): Promise<vscode.TextSearchComplete> {
|
||||
assert.deepEqual(options.includes.sort(), ['*.jsx', '*.ts']);
|
||||
assert.deepEqual(options.excludes.sort(), []);
|
||||
assert.deepStrictEqual(options.includes.sort(), ['*.jsx', '*.ts']);
|
||||
assert.deepStrictEqual(options.excludes.sort(), []);
|
||||
|
||||
return Promise.resolve(null!);
|
||||
}
|
||||
@@ -1184,8 +1188,8 @@ suite('ExtHostSearch', () => {
|
||||
};
|
||||
|
||||
const { results } = await runTextSearch(query);
|
||||
assert.equal(results.length, 2);
|
||||
assert.equal(cancels, 2);
|
||||
assert.strictEqual(results.length, 2);
|
||||
assert.strictEqual(cancels, 2);
|
||||
});
|
||||
|
||||
test('works with non-file schemes', async () => {
|
||||
|
||||
@@ -28,13 +28,13 @@ suite('MainThreadWorkspace', () => {
|
||||
test('simple', () => {
|
||||
instantiationService.stub(ISearchService, {
|
||||
fileSearch(query: IFileQuery) {
|
||||
assert.equal(query.folderQueries.length, 1);
|
||||
assert.equal(query.folderQueries[0].disregardIgnoreFiles, true);
|
||||
assert.strictEqual(query.folderQueries.length, 1);
|
||||
assert.strictEqual(query.folderQueries[0].disregardIgnoreFiles, true);
|
||||
|
||||
assert.deepEqual(query.includePattern, { 'foo': true });
|
||||
assert.equal(query.maxResults, 10);
|
||||
assert.strictEqual(query.maxResults, 10);
|
||||
|
||||
return Promise.resolve({ results: [] });
|
||||
return Promise.resolve({ results: [], messages: [] });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -52,11 +52,11 @@ suite('MainThreadWorkspace', () => {
|
||||
|
||||
instantiationService.stub(ISearchService, {
|
||||
fileSearch(query: IFileQuery) {
|
||||
assert.equal(query.folderQueries.length, 1);
|
||||
assert.equal(query.folderQueries[0].disregardIgnoreFiles, true);
|
||||
assert.deepEqual(query.folderQueries[0].excludePattern, { 'filesExclude': true });
|
||||
assert.strictEqual(query.folderQueries.length, 1);
|
||||
assert.strictEqual(query.folderQueries[0].disregardIgnoreFiles, true);
|
||||
assert.deepStrictEqual(query.folderQueries[0].excludePattern, { 'filesExclude': true });
|
||||
|
||||
return Promise.resolve({ results: [] });
|
||||
return Promise.resolve({ results: [], messages: [] });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -74,10 +74,10 @@ suite('MainThreadWorkspace', () => {
|
||||
|
||||
instantiationService.stub(ISearchService, {
|
||||
fileSearch(query: IFileQuery) {
|
||||
assert.equal(query.folderQueries[0].excludePattern, undefined);
|
||||
assert.deepEqual(query.excludePattern, undefined);
|
||||
assert.strictEqual(query.folderQueries[0].excludePattern, undefined);
|
||||
assert.deepStrictEqual(query.excludePattern, undefined);
|
||||
|
||||
return Promise.resolve({ results: [] });
|
||||
return Promise.resolve({ results: [], messages: [] });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -88,10 +88,10 @@ suite('MainThreadWorkspace', () => {
|
||||
test('exclude string', () => {
|
||||
instantiationService.stub(ISearchService, {
|
||||
fileSearch(query: IFileQuery) {
|
||||
assert.equal(query.folderQueries[0].excludePattern, undefined);
|
||||
assert.strictEqual(query.folderQueries[0].excludePattern, undefined);
|
||||
assert.deepEqual(query.excludePattern, { 'exclude/**': true });
|
||||
|
||||
return Promise.resolve({ results: [] });
|
||||
return Promise.resolve({ results: [], messages: [] });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -10,12 +10,13 @@ import * as fs from 'fs';
|
||||
import * as pfs from 'vs/base/node/pfs';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import * as assert from 'assert';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { getPathFromAmdModule } from 'vs/base/test/node/testUtils';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { RequestService } from 'vs/platform/request/node/requestService';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import 'vs/workbench/workbench.desktop.main';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import { TestEnvironmentService } from 'vs/workbench/test/electron-browser/workbenchTestServices';
|
||||
|
||||
interface ColorInfo {
|
||||
description: string;
|
||||
@@ -33,7 +34,7 @@ export const experimental: string[] = []; // 'settings.modifiedItemForeground',
|
||||
suite('Color Registry', function () {
|
||||
|
||||
test('all colors documented in theme-color.md', async function () {
|
||||
const reqContext = await new RequestService(new TestConfigurationService(), new NullLogService()).request({ url: 'https://raw.githubusercontent.com/microsoft/vscode-docs/vnext/api/references/theme-color.md' }, CancellationToken.None);
|
||||
const reqContext = await new RequestService(new TestConfigurationService(), TestEnvironmentService, new NullLogService()).request({ url: 'https://raw.githubusercontent.com/microsoft/vscode-docs/vnext/api/references/theme-color.md' }, CancellationToken.None);
|
||||
const content = (await asText(reqContext))!;
|
||||
|
||||
const expression = /\-\s*\`([\w\.]+)\`: (.*)/g;
|
||||
@@ -83,10 +84,10 @@ suite('Color Registry', function () {
|
||||
}
|
||||
|
||||
let undocumentedKeys = Object.keys(missing).map(k => `\`${k}\`: ${missing[k]}`);
|
||||
assert.deepEqual(undocumentedKeys, [], 'Undocumented colors ids');
|
||||
assert.deepStrictEqual(undocumentedKeys, [], 'Undocumented colors ids');
|
||||
|
||||
let superfluousKeys = Object.keys(colorsInDoc);
|
||||
assert.deepEqual(superfluousKeys, [], 'Colors ids in doc that do not exist');
|
||||
assert.deepStrictEqual(superfluousKeys, [], 'Colors ids in doc that do not exist');
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,46 +3,46 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/workbench/contrib/search/browser/search.contribution'; // load contributions
|
||||
import * as assert from 'assert';
|
||||
import * as fs from 'fs';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { createSyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { ISearchService } from 'vs/workbench/services/search/common/search';
|
||||
import { ITelemetryService, ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IUntitledTextEditorService, UntitledTextEditorService } from 'vs/workbench/services/untitled/common/untitledTextEditorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import * as minimist from 'minimist';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import { LocalSearchService } from 'vs/workbench/services/search/electron-browser/searchService';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { TestEditorService, TestEditorGroupsService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { TestEnvironmentService } from 'vs/workbench/test/electron-browser/workbenchTestServices';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
|
||||
import { SearchModel } from 'vs/workbench/contrib/search/common/searchModel';
|
||||
import { QueryBuilder, ITextQueryBuilderOptions } from 'vs/workbench/contrib/search/common/queryBuilder';
|
||||
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { testWorkspace } from 'vs/platform/workspace/test/common/testWorkspace';
|
||||
import { NullLogService, ILogService } from 'vs/platform/log/common/log';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { ClassifiedEvent, StrictPropertyCheck, GDPRClassification } from 'vs/platform/telemetry/common/gdprTypings';
|
||||
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
|
||||
import { UndoRedoService } from 'vs/platform/undoRedo/common/undoRedoService';
|
||||
import { TestDialogService } from 'vs/platform/dialogs/test/common/testDialogService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
|
||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
||||
import { TestDialogService } from 'vs/platform/dialogs/test/common/testDialogService';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { ILogService, NullLogService } from 'vs/platform/log/common/log';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { TestTextResourcePropertiesService, TestContextService } from 'vs/workbench/test/common/workbenchTestServices';
|
||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
||||
import { ClassifiedEvent, GDPRClassification, StrictPropertyCheck } from 'vs/platform/telemetry/common/gdprTypings';
|
||||
import { ITelemetryInfo, ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
|
||||
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
|
||||
import { UndoRedoService } from 'vs/platform/undoRedo/common/undoRedoService';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { testWorkspace } from 'vs/platform/workspace/test/common/testWorkspace';
|
||||
import 'vs/workbench/contrib/search/browser/search.contribution'; // load contributions
|
||||
import { ITextQueryBuilderOptions, QueryBuilder } from 'vs/workbench/contrib/search/common/queryBuilder';
|
||||
import { SearchModel } from 'vs/workbench/contrib/search/common/searchModel';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ISearchService } from 'vs/workbench/services/search/common/search';
|
||||
import { LocalSearchService } from 'vs/workbench/services/search/electron-browser/searchService';
|
||||
import { IUntitledTextEditorService, UntitledTextEditorService } from 'vs/workbench/services/untitled/common/untitledTextEditorService';
|
||||
import { TestEditorGroupsService, TestEditorService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { TestContextService, TestTextResourcePropertiesService } from 'vs/workbench/test/common/workbenchTestServices';
|
||||
import { TestEnvironmentService } from 'vs/workbench/test/electron-browser/workbenchTestServices';
|
||||
|
||||
|
||||
|
||||
// declare var __dirname: string;
|
||||
|
||||
@@ -84,8 +84,8 @@ suite.skip('TextSearch performance (integration)', () => {
|
||||
[IEditorService, new TestEditorService()],
|
||||
[IEditorGroupsService, new TestEditorGroupsService()],
|
||||
[IEnvironmentService, TestEnvironmentService],
|
||||
[IUntitledTextEditorService, createSyncDescriptor(UntitledTextEditorService)],
|
||||
[ISearchService, createSyncDescriptor(LocalSearchService)],
|
||||
[IUntitledTextEditorService, new SyncDescriptor(UntitledTextEditorService)],
|
||||
[ISearchService, new SyncDescriptor(LocalSearchService)],
|
||||
[ILogService, logService]
|
||||
));
|
||||
|
||||
@@ -105,12 +105,12 @@ suite.skip('TextSearch performance (integration)', () => {
|
||||
function onComplete(): void {
|
||||
try {
|
||||
const allEvents = telemetryService.events.map(e => JSON.stringify(e)).join('\n');
|
||||
assert.equal(telemetryService.events.length, 3, 'Expected 3 telemetry events, got:\n' + allEvents);
|
||||
assert.strictEqual(telemetryService.events.length, 3, 'Expected 3 telemetry events, got:\n' + allEvents);
|
||||
|
||||
const [firstRenderEvent, resultsShownEvent, resultsFinishedEvent] = telemetryService.events;
|
||||
assert.equal(firstRenderEvent.name, 'searchResultsFirstRender');
|
||||
assert.equal(resultsShownEvent.name, 'searchResultsShown');
|
||||
assert.equal(resultsFinishedEvent.name, 'searchResultsFinished');
|
||||
assert.strictEqual(firstRenderEvent.name, 'searchResultsFirstRender');
|
||||
assert.strictEqual(resultsShownEvent.name, 'searchResultsShown');
|
||||
assert.strictEqual(resultsFinishedEvent.name, 'searchResultsFinished');
|
||||
|
||||
telemetryService.events = [];
|
||||
|
||||
@@ -202,7 +202,8 @@ class TestTelemetryService implements ITelemetryService {
|
||||
return Promise.resolve({
|
||||
instanceId: 'someValue.instanceId',
|
||||
sessionId: 'someValue.sessionId',
|
||||
machineId: 'someValue.machineId'
|
||||
machineId: 'someValue.machineId',
|
||||
firstSessionDate: 'someValue.firstSessionDate'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,16 +5,15 @@
|
||||
|
||||
import { workbenchInstantiationService as browserWorkbenchInstantiationService, ITestInstantiationService, TestLifecycleService, TestFilesConfigurationService, TestFileService, TestFileDialogService, TestPathService, TestEncodingOracle, TestProductService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
|
||||
import { NativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-browser/environmentService';
|
||||
import { NativeTextFileService, } from 'vs/workbench/services/textfile/electron-browser/nativeTextFileService';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-sandbox/services';
|
||||
import { NativeTextFileService, } from 'vs/workbench/services/textfile/electron-sandbox/nativeTextFileService';
|
||||
import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
|
||||
import { FileOperationError, IFileService } from 'vs/platform/files/common/files';
|
||||
import { IUntitledTextEditorService } from 'vs/workbench/services/untitled/common/untitledTextEditorService';
|
||||
import { ILifecycleService } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { INativeWorkbenchConfiguration, INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService';
|
||||
import { INativeWorkbenchConfiguration, INativeWorkbenchEnvironmentService, NativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService';
|
||||
import { IDialogService, IFileDialogService, INativeOpenDialogOptions } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
@@ -31,8 +30,8 @@ import { IPathService } from 'vs/workbench/services/path/common/pathService';
|
||||
import { IWorkingCopyFileService } from 'vs/workbench/services/workingCopy/common/workingCopyFileService';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
|
||||
import { NodeTestBackupFileService } from 'vs/workbench/services/backup/test/electron-browser/backupFileService.test';
|
||||
import { IWorkingCopyBackupService } from 'vs/workbench/services/workingCopy/common/workingCopyBackup';
|
||||
import { NodeTestWorkingCopyBackupService } from 'vs/workbench/services/workingCopy/test/electron-browser/workingCopyBackupService.test';
|
||||
import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { TestContextService } from 'vs/workbench/test/common/workbenchTestServices';
|
||||
@@ -40,12 +39,18 @@ import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/ur
|
||||
import { MouseInputEvent } from 'vs/base/parts/sandbox/common/electronTypes';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { IOSProperties, IOSStatistics } from 'vs/platform/native/common/native';
|
||||
import { homedir, release } from 'os';
|
||||
import { homedir, release, tmpdir, hostname } from 'os';
|
||||
import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { getUserDataPath } from 'vs/platform/environment/node/userDataPath';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { IElevatedFileService } from 'vs/workbench/services/files/common/elevatedFileService';
|
||||
|
||||
const args = parseArgs(process.argv, OPTIONS);
|
||||
|
||||
export const TestWorkbenchConfiguration: INativeWorkbenchConfiguration = {
|
||||
windowId: 0,
|
||||
machineId: 'testMachineId',
|
||||
sessionId: 'testSessionId',
|
||||
logLevel: LogLevel.Error,
|
||||
mainPid: 0,
|
||||
partsSplashPath: '',
|
||||
@@ -54,8 +59,12 @@ export const TestWorkbenchConfiguration: INativeWorkbenchConfiguration = {
|
||||
execPath: process.execPath,
|
||||
perfMarks: [],
|
||||
colorScheme: { dark: true, highContrast: false },
|
||||
os: { release: release() },
|
||||
...parseArgs(process.argv, OPTIONS)
|
||||
os: { release: release(), hostname: hostname() },
|
||||
product,
|
||||
homeDir: homedir(),
|
||||
tmpDir: tmpdir(),
|
||||
userDataDir: getUserDataPath(args),
|
||||
...args
|
||||
};
|
||||
|
||||
export const TestEnvironmentService = new NativeWorkbenchEnvironmentService(TestWorkbenchConfiguration, TestProductService);
|
||||
@@ -64,7 +73,7 @@ export class TestTextFileService extends NativeTextFileService {
|
||||
private resolveTextContentError!: FileOperationError | null;
|
||||
|
||||
constructor(
|
||||
@IFileService protected fileService: IFileService,
|
||||
@IFileService fileService: IFileService,
|
||||
@IUntitledTextEditorService untitledTextEditorService: IUntitledTextEditorService,
|
||||
@ILifecycleService lifecycleService: ILifecycleService,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@@ -82,7 +91,7 @@ export class TestTextFileService extends NativeTextFileService {
|
||||
@ILogService logService: ILogService,
|
||||
@IUriIdentityService uriIdentityService: IUriIdentityService,
|
||||
@IModeService modeService: IModeService,
|
||||
@INativeHostService nativeHostService: INativeHostService
|
||||
@IElevatedFileService elevatedFileService: IElevatedFileService
|
||||
) {
|
||||
super(
|
||||
fileService,
|
||||
@@ -101,7 +110,7 @@ export class TestTextFileService extends NativeTextFileService {
|
||||
workingCopyFileService,
|
||||
uriIdentityService,
|
||||
modeService,
|
||||
nativeHostService,
|
||||
elevatedFileService,
|
||||
logService
|
||||
);
|
||||
}
|
||||
@@ -110,7 +119,7 @@ export class TestTextFileService extends NativeTextFileService {
|
||||
this.resolveTextContentError = error;
|
||||
}
|
||||
|
||||
async readStream(resource: URI, options?: IReadTextFileOptions): Promise<ITextFileStreamContent> {
|
||||
override async readStream(resource: URI, options?: IReadTextFileOptions): Promise<ITextFileStreamContent> {
|
||||
if (this.resolveTextContentError) {
|
||||
const error = this.resolveTextContentError;
|
||||
this.resolveTextContentError = null;
|
||||
@@ -135,7 +144,7 @@ export class TestTextFileService extends NativeTextFileService {
|
||||
export class TestNativeTextFileServiceWithEncodingOverrides extends NativeTextFileService {
|
||||
|
||||
private _testEncoding: TestEncodingOracle | undefined;
|
||||
get encoding(): TestEncodingOracle {
|
||||
override get encoding(): TestEncodingOracle {
|
||||
if (!this._testEncoding) {
|
||||
this._testEncoding = this._register(this.instantiationService.createInstance(TestEncodingOracle));
|
||||
}
|
||||
@@ -167,6 +176,7 @@ export class TestNativeHostService implements INativeHostService {
|
||||
onDidResumeOS: Event<unknown> = Event.None;
|
||||
onDidChangeColorScheme = Event.None;
|
||||
onDidChangePassword = Event.None;
|
||||
onDidChangeDisplay = Event.None;
|
||||
|
||||
windowCount = Promise.resolve(1);
|
||||
getWindowCount(): Promise<number> { return this.windowCount; }
|
||||
@@ -198,7 +208,7 @@ export class TestNativeHostService implements INativeHostService {
|
||||
async showItemInFolder(path: string): Promise<void> { }
|
||||
async setRepresentedFilename(path: string): Promise<void> { }
|
||||
async isAdmin(): Promise<boolean> { return false; }
|
||||
async writeElevated(source: URI, target: URI, options?: { overwriteReadonly?: boolean | undefined; }): Promise<void> { }
|
||||
async writeElevated(source: URI, target: URI): Promise<void> { }
|
||||
async getOSProperties(): Promise<IOSProperties> { return Object.create(null); }
|
||||
async getOSStatistics(): Promise<IOSStatistics> { return Object.create(null); }
|
||||
async getOSVirtualMachineHint(): Promise<number> { return 0; }
|
||||
@@ -248,6 +258,9 @@ export function workbenchInstantiationService(): ITestInstantiationService {
|
||||
});
|
||||
|
||||
instantiationService.stub(INativeHostService, new TestNativeHostService());
|
||||
instantiationService.stub(IEnvironmentService, TestEnvironmentService);
|
||||
instantiationService.stub(INativeEnvironmentService, TestEnvironmentService);
|
||||
instantiationService.stub(IWorkbenchEnvironmentService, TestEnvironmentService);
|
||||
instantiationService.stub(INativeWorkbenchEnvironmentService, TestEnvironmentService);
|
||||
|
||||
return instantiationService;
|
||||
@@ -263,7 +276,7 @@ export class TestServiceAccessor {
|
||||
@IFileService public fileService: TestFileService,
|
||||
@INativeHostService public nativeHostService: TestNativeHostService,
|
||||
@IFileDialogService public fileDialogService: TestFileDialogService,
|
||||
@IBackupFileService public backupFileService: NodeTestBackupFileService,
|
||||
@IWorkingCopyBackupService public workingCopyBackupService: NodeTestWorkingCopyBackupService,
|
||||
@IWorkingCopyService public workingCopyService: IWorkingCopyService,
|
||||
@IEditorService public editorService: IEditorService
|
||||
) {
|
||||
@@ -272,8 +285,6 @@ export class TestServiceAccessor {
|
||||
|
||||
export class TestNativePathService extends TestPathService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
constructor() {
|
||||
super(URI.file(homedir()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user