Merge from vscode bd0efff9e3f36d6b3e1045cee9887003af8034d7

This commit is contained in:
ADS Merger
2020-05-06 02:35:49 +00:00
parent 9a7810cbee
commit 8420d9f04e
243 changed files with 4276 additions and 2478 deletions

View File

@@ -13,6 +13,7 @@ import { mock } from 'vs/workbench/test/browser/api/mock';
import { Emitter, Event } from 'vs/base/common/event';
import { NullLogService } from 'vs/platform/log/common/log';
import type * as vscode from 'vscode';
import { nullExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
suite('ExtHostDiagnostics', () => {
@@ -286,7 +287,7 @@ suite('ExtHostDiagnostics', () => {
});
test('diagnostic eventing', async function () {
let emitter = new Emitter<Array<string | URI>>();
let emitter = new Emitter<Array<URI>>();
let collection = new DiagnosticCollection('ddd', 'test', 100, new DiagnosticsShape(), emitter);
let diag1 = new Diagnostic(new Range(1, 1, 2, 3), 'diag1');
@@ -316,15 +317,15 @@ suite('ExtHostDiagnostics', () => {
p = Event.toPromise(emitter.event).then(e => {
assert.equal(e.length, 2);
assert.ok(typeof e[0] === 'string');
assert.ok(typeof e[1] === 'string');
assert.ok(URI.isUri(e[0]));
assert.ok(URI.isUri(e[1]));
});
collection.clear();
await p;
});
test('vscode.languages.onDidChangeDiagnostics Does Not Provide Document URI #49582', async function () {
let emitter = new Emitter<Array<string | URI>>();
let emitter = new Emitter<Array<URI>>();
let collection = new DiagnosticCollection('ddd', 'test', 100, new DiagnosticsShape(), emitter);
let diag1 = new Diagnostic(new Range(1, 1, 2, 3), 'diag1');
@@ -390,8 +391,8 @@ suite('ExtHostDiagnostics', () => {
}
}, new NullLogService());
let collection1 = diags.createDiagnosticCollection('foo');
let collection2 = diags.createDiagnosticCollection('foo'); // warns, uses a different owner
let collection1 = diags.createDiagnosticCollection(nullExtensionDescription.identifier, 'foo');
let collection2 = diags.createDiagnosticCollection(nullExtensionDescription.identifier, 'foo'); // warns, uses a different owner
collection1.clear();
collection2.clear();

View File

@@ -145,11 +145,18 @@ interface ISerializedTestInput {
class TestEditorInputFactory implements IEditorInputFactory {
static disableSerialize = false;
static disableDeserialize = false;
canSerialize(editorInput: EditorInput): boolean {
return true;
}
serialize(editorInput: EditorInput): string {
serialize(editorInput: EditorInput): string | undefined {
if (TestEditorInputFactory.disableSerialize) {
return undefined;
}
let testEditorInput = <TestEditorInput>editorInput;
let testInput: ISerializedTestInput = {
id: testEditorInput.id
@@ -158,7 +165,11 @@ class TestEditorInputFactory implements IEditorInputFactory {
return JSON.stringify(testInput);
}
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput {
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput | undefined {
if (TestEditorInputFactory.disableDeserialize) {
return undefined;
}
let testInput: ISerializedTestInput = JSON.parse(serializedEditorInput);
return new TestEditorInput(testInput.id);
@@ -170,6 +181,9 @@ suite('Workbench editor groups', () => {
let disposables: IDisposable[] = [];
setup(() => {
TestEditorInputFactory.disableSerialize = false;
TestEditorInputFactory.disableDeserialize = false;
disposables.push(Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories).registerEditorInputFactory('testEditorInputForGroups', TestEditorInputFactory));
});
@@ -296,18 +310,40 @@ suite('Workbench editor groups', () => {
const input2 = input();
const input3 = input();
// Pinned and Active
// Case 1: inputs can be serialized and deserialized
group.openEditor(input1, { pinned: true, active: true });
group.openEditor(input2, { pinned: true, active: true });
group.openEditor(input3, { pinned: false, active: true });
const deserialized = createGroup(group.serialize());
let deserialized = createGroup(group.serialize());
assert.equal(group.id, deserialized.id);
assert.equal(deserialized.count, 3);
assert.equal(deserialized.getEditors(EditorsOrder.SEQUENTIAL).length, 3);
assert.equal(deserialized.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE).length, 3);
assert.equal(deserialized.isPinned(input1), true);
assert.equal(deserialized.isPinned(input2), true);
assert.equal(deserialized.isPinned(input3), false);
assert.equal(deserialized.isActive(input3), true);
// Case 2: inputs cannot be serialized
TestEditorInputFactory.disableSerialize = true;
deserialized = createGroup(group.serialize());
assert.equal(group.id, deserialized.id);
assert.equal(deserialized.count, 0);
assert.equal(deserialized.getEditors(EditorsOrder.SEQUENTIAL).length, 0);
assert.equal(deserialized.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE).length, 0);
// Case 3: inputs cannot be deserialized
TestEditorInputFactory.disableSerialize = false;
TestEditorInputFactory.disableDeserialize = true;
deserialized = createGroup(group.serialize());
assert.equal(group.id, deserialized.id);
assert.equal(deserialized.count, 0);
assert.equal(deserialized.getEditors(EditorsOrder.SEQUENTIAL).length, 0);
assert.equal(deserialized.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE).length, 0);
});
test('One Editor', function () {

View File

@@ -104,8 +104,9 @@ import { QuickInputService } from 'vs/workbench/services/quickinput/browser/quic
import { IListService } from 'vs/platform/list/browser/listService';
import { win32, posix } from 'vs/base/common/path';
import { TestWorkingCopyService, TestContextService, TestStorageService, TestTextResourcePropertiesService, TestExtensionService } from 'vs/workbench/test/common/workbenchTestServices';
import { IViewsService, IView } from 'vs/workbench/common/views';
import { IViewsService, IView, ViewContainer, ViewContainerLocation } from 'vs/workbench/common/views';
import { IStorageKeysSyncRegistryService, StorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys';
import { IPaneComposite } from 'vs/workbench/common/panecomposite';
export function createFileEditorInput(instantiationService: IInstantiationService, resource: URI): FileEditorInput {
return instantiationService.createInstance(FileEditorInput, resource, undefined, undefined);
@@ -474,14 +475,20 @@ export class TestPanelService implements IPanelService {
export class TestViewsService implements IViewsService {
_serviceBrand: undefined;
onDidChangeViewVisibilityEmitter = new Emitter<{ id: string; visible: boolean; }>();
onDidChangeViewContainerVisibility = new Emitter<{ id: string; visible: boolean; location: ViewContainerLocation }>().event;
isViewContainerVisible(id: string): boolean { return true; }
getVisibleViewContainer(): ViewContainer | null { return null; }
openViewContainer(id: string, focus?: boolean): Promise<IPaneComposite | null> { return Promise.resolve(null); }
closeViewContainer(id: string): void { }
onDidChangeViewVisibilityEmitter = new Emitter<{ id: string; visible: boolean; }>();
onDidChangeViewVisibility = this.onDidChangeViewVisibilityEmitter.event;
isViewVisible(id: string): boolean { return true; }
getActiveViewWithId<T extends IView>(id: string): T | null { return null; }
openView<T extends IView>(id: string, focus?: boolean | undefined): Promise<T | null> { return Promise.resolve(null); }
closeView(id: string): void { }
getProgressIndicator(id: string) { return null!; }
getViewProgressIndicator(id: string) { return null!; }
}
export class TestEditorGroupsService implements IEditorGroupsService {