mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 4636be2b71c87bfb0bfe3c94278b447a5efcc1f1 (#8722)
* Merge from vscode 4636be2b71c87bfb0bfe3c94278b447a5efcc1f1 * remove tests that aren't working
This commit is contained in:
@@ -6,19 +6,19 @@
|
||||
import * as assert from 'assert';
|
||||
import { BaseEditor, EditorMemento } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { EditorInput, EditorOptions, IEditorInputFactory, IEditorInputFactoryRegistry, Extensions as EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import * as Platform from 'vs/platform/registry/common/platform';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { workbenchInstantiationService, TestEditorGroup, TestEditorGroupsService, TestStorageService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { workbenchInstantiationService, TestEditorGroupView, TestEditorGroupsService, TestStorageService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
|
||||
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IEditorRegistry, Extensions, EditorDescriptor } from 'vs/workbench/browser/editor';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IEditorModel } from 'vs/platform/editor/common/editor';
|
||||
import { dispose } from 'vs/base/common/lifecycle';
|
||||
|
||||
const NullThemeService = new TestThemeService();
|
||||
|
||||
@@ -50,6 +50,10 @@ export class MyOtherEditor extends BaseEditor {
|
||||
|
||||
class MyInputFactory implements IEditorInputFactory {
|
||||
|
||||
canSerialize(editorInput: EditorInput): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
serialize(input: EditorInput): string {
|
||||
return input.toString();
|
||||
}
|
||||
@@ -98,7 +102,7 @@ suite('Workbench base editor', () => {
|
||||
await e.setInput(input, options, CancellationToken.None);
|
||||
assert.strictEqual(input, e.input);
|
||||
assert.strictEqual(options, e.options);
|
||||
const group = new TestEditorGroup(1);
|
||||
const group = new TestEditorGroupView(1);
|
||||
e.setVisible(true, group);
|
||||
assert(e.isVisible());
|
||||
assert.equal(e.group, group);
|
||||
@@ -127,8 +131,8 @@ suite('Workbench base editor', () => {
|
||||
let oldEditorsCnt = EditorRegistry.getEditors().length;
|
||||
let oldInputCnt = (<any>EditorRegistry).getEditorInputs().length;
|
||||
|
||||
EditorRegistry.registerEditor(d1, [new SyncDescriptor(MyInput)]);
|
||||
EditorRegistry.registerEditor(d2, [new SyncDescriptor(MyInput), new SyncDescriptor(MyOtherInput)]);
|
||||
const dispose1 = EditorRegistry.registerEditor(d1, [new SyncDescriptor(MyInput)]);
|
||||
const dispose2 = EditorRegistry.registerEditor(d2, [new SyncDescriptor(MyInput), new SyncDescriptor(MyOtherInput)]);
|
||||
|
||||
assert.equal(EditorRegistry.getEditors().length, oldEditorsCnt + 2);
|
||||
assert.equal((<any>EditorRegistry).getEditorInputs().length, oldInputCnt + 3);
|
||||
@@ -139,62 +143,52 @@ suite('Workbench base editor', () => {
|
||||
assert.strictEqual(EditorRegistry.getEditorById('id1'), d1);
|
||||
assert.strictEqual(EditorRegistry.getEditorById('id2'), d2);
|
||||
assert(!EditorRegistry.getEditorById('id3'));
|
||||
|
||||
dispose([dispose1, dispose2]);
|
||||
});
|
||||
|
||||
test('Editor Lookup favors specific class over superclass (match on specific class)', function () {
|
||||
let d1 = EditorDescriptor.create(MyEditor, 'id1', 'name');
|
||||
let d2 = EditorDescriptor.create(MyOtherEditor, 'id2', 'name');
|
||||
|
||||
let oldEditors = EditorRegistry.getEditors();
|
||||
(<any>EditorRegistry).setEditors([]);
|
||||
const disposable = EditorRegistry.registerEditor(d1, [new SyncDescriptor(MyResourceInput)]);
|
||||
|
||||
EditorRegistry.registerEditor(d2, [new SyncDescriptor(ResourceEditorInput)]);
|
||||
EditorRegistry.registerEditor(d1, [new SyncDescriptor(MyResourceInput)]);
|
||||
|
||||
let inst = new TestInstantiationService();
|
||||
let inst = workbenchInstantiationService();
|
||||
|
||||
const editor = EditorRegistry.getEditor(inst.createInstance(MyResourceInput, 'fake', '', URI.file('/fake'), undefined))!.instantiate(inst);
|
||||
assert.strictEqual(editor.getId(), 'myEditor');
|
||||
|
||||
const otherEditor = EditorRegistry.getEditor(inst.createInstance(ResourceEditorInput, 'fake', '', URI.file('/fake'), undefined))!.instantiate(inst);
|
||||
assert.strictEqual(otherEditor.getId(), 'myOtherEditor');
|
||||
assert.strictEqual(otherEditor.getId(), 'workbench.editors.textResourceEditor');
|
||||
|
||||
(<any>EditorRegistry).setEditors(oldEditors);
|
||||
disposable.dispose();
|
||||
});
|
||||
|
||||
test('Editor Lookup favors specific class over superclass (match on super class)', function () {
|
||||
let d1 = EditorDescriptor.create(MyOtherEditor, 'id1', 'name');
|
||||
|
||||
let oldEditors = EditorRegistry.getEditors();
|
||||
(<any>EditorRegistry).setEditors([]);
|
||||
|
||||
EditorRegistry.registerEditor(d1, [new SyncDescriptor(ResourceEditorInput)]);
|
||||
|
||||
let inst = new TestInstantiationService();
|
||||
let inst = workbenchInstantiationService();
|
||||
|
||||
const editor = EditorRegistry.getEditor(inst.createInstance(MyResourceInput, 'fake', '', URI.file('/fake'), undefined))!.instantiate(inst);
|
||||
assert.strictEqual('myOtherEditor', editor.getId());
|
||||
|
||||
(<any>EditorRegistry).setEditors(oldEditors);
|
||||
assert.strictEqual('workbench.editors.textResourceEditor', editor.getId());
|
||||
});
|
||||
|
||||
test('Editor Input Factory', function () {
|
||||
workbenchInstantiationService().invokeFunction(accessor => EditorInputRegistry.start(accessor));
|
||||
EditorInputRegistry.registerEditorInputFactory('myInputId', MyInputFactory);
|
||||
const disposable = EditorInputRegistry.registerEditorInputFactory('myInputId', MyInputFactory);
|
||||
|
||||
let factory = EditorInputRegistry.getEditorInputFactory('myInputId');
|
||||
assert(factory);
|
||||
|
||||
disposable.dispose();
|
||||
});
|
||||
|
||||
test('EditorMemento - basics', function () {
|
||||
const testGroup0 = new TestEditorGroup(0);
|
||||
const testGroup1 = new TestEditorGroup(1);
|
||||
const testGroup4 = new TestEditorGroup(4);
|
||||
const testGroup0 = new TestEditorGroupView(0);
|
||||
const testGroup1 = new TestEditorGroupView(1);
|
||||
const testGroup4 = new TestEditorGroupView(4);
|
||||
|
||||
const editorGroupService = new TestEditorGroupsService([
|
||||
testGroup0,
|
||||
testGroup1,
|
||||
new TestEditorGroup(2)
|
||||
new TestEditorGroupView(2)
|
||||
]);
|
||||
|
||||
interface TestViewState {
|
||||
@@ -255,7 +249,7 @@ suite('Workbench base editor', () => {
|
||||
});
|
||||
|
||||
test('EditoMemento - use with editor input', function () {
|
||||
const testGroup0 = new TestEditorGroup(0);
|
||||
const testGroup0 = new TestEditorGroupView(0);
|
||||
|
||||
interface TestViewState {
|
||||
line: number;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { ContributableViewsModel, ViewsService, IViewState } from 'vs/workbench/browser/parts/views/views';
|
||||
import { IViewsRegistry, IViewDescriptor, IViewContainersRegistry, Extensions as ViewContainerExtensions, IViewsService } from 'vs/workbench/common/views';
|
||||
import { IViewsRegistry, IViewDescriptor, IViewContainersRegistry, Extensions as ViewContainerExtensions, IViewsService, ViewContainerLocation } from 'vs/workbench/common/views';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { move } from 'vs/base/common/arrays';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
@@ -15,7 +15,7 @@ import { TestInstantiationService } from 'vs/platform/instantiation/test/common/
|
||||
import { ContextKeyService } from 'vs/platform/contextkey/browser/contextKeyService';
|
||||
import sinon = require('sinon');
|
||||
|
||||
const container = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer('test');
|
||||
const container = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer('test', ViewContainerLocation.Sidebar);
|
||||
const ViewsRegistry = Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry);
|
||||
|
||||
class ViewDescriptorSequence {
|
||||
|
||||
@@ -20,6 +20,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
|
||||
function inst(): IInstantiationService {
|
||||
let inst = new TestInstantiationService();
|
||||
@@ -138,6 +139,10 @@ interface ISerializedTestInput {
|
||||
|
||||
class TestEditorInputFactory implements IEditorInputFactory {
|
||||
|
||||
canSerialize(editorInput: EditorInput): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
serialize(editorInput: EditorInput): string {
|
||||
let testEditorInput = <TestEditorInput>editorInput;
|
||||
let testInput: ISerializedTestInput = {
|
||||
@@ -156,13 +161,16 @@ class TestEditorInputFactory implements IEditorInputFactory {
|
||||
|
||||
suite('Workbench editor groups', () => {
|
||||
|
||||
function registerEditorInputFactory() {
|
||||
Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories).registerEditorInputFactory('testEditorInputForGroups', TestEditorInputFactory);
|
||||
}
|
||||
let disposables: IDisposable[] = [];
|
||||
|
||||
registerEditorInputFactory();
|
||||
setup(() => {
|
||||
disposables.push(Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories).registerEditorInputFactory('testEditorInputForGroups', TestEditorInputFactory));
|
||||
});
|
||||
|
||||
teardown(() => {
|
||||
dispose(disposables);
|
||||
disposables = [];
|
||||
|
||||
index = 1;
|
||||
});
|
||||
|
||||
@@ -260,6 +268,16 @@ suite('Workbench editor groups', () => {
|
||||
assert.equal(group.contains(input2, true), false);
|
||||
assert.equal(group.contains(diffInput1), false);
|
||||
assert.equal(group.contains(diffInput2), false);
|
||||
|
||||
const input3 = input(undefined, true, URI.parse('foo://bar'));
|
||||
|
||||
group.openEditor(input3, { pinned: true, active: true });
|
||||
assert.equal(group.contains({ resource: URI.parse('foo://barsomething') }), false);
|
||||
assert.equal(group.contains({ resource: URI.parse('foo://bar') }), true);
|
||||
|
||||
group.closeEditor(input3);
|
||||
|
||||
assert.equal(group.contains({ resource: URI.parse('foo://bar') }), false);
|
||||
});
|
||||
|
||||
test('group serialization', function () {
|
||||
@@ -293,7 +311,8 @@ suite('Workbench editor groups', () => {
|
||||
|
||||
// Active && Pinned
|
||||
const input1 = input();
|
||||
group.openEditor(input1, { active: true, pinned: true });
|
||||
const openedEditor = group.openEditor(input1, { active: true, pinned: true });
|
||||
assert.equal(openedEditor, input1);
|
||||
|
||||
assert.equal(group.count, 1);
|
||||
assert.equal(group.getEditors(true).length, 1);
|
||||
@@ -306,8 +325,8 @@ suite('Workbench editor groups', () => {
|
||||
assert.equal(events.opened[0], input1);
|
||||
assert.equal(events.activated[0], input1);
|
||||
|
||||
let index = group.closeEditor(input1);
|
||||
assert.equal(index, 0);
|
||||
let editor = group.closeEditor(input1);
|
||||
assert.equal(editor, input1);
|
||||
assert.equal(group.count, 0);
|
||||
assert.equal(group.getEditors(true).length, 0);
|
||||
assert.equal(group.activeEditor, undefined);
|
||||
@@ -338,8 +357,8 @@ suite('Workbench editor groups', () => {
|
||||
assert.equal(events.closed[1].index, 0);
|
||||
assert.equal(events.closed[1].replaced, false);
|
||||
|
||||
index = group.closeEditor(input2);
|
||||
assert.ok(typeof index !== 'number');
|
||||
editor = group.closeEditor(input2);
|
||||
assert.ok(!editor);
|
||||
assert.equal(group.count, 0);
|
||||
assert.equal(group.getEditors(true).length, 0);
|
||||
assert.equal(group.activeEditor, undefined);
|
||||
@@ -401,12 +420,18 @@ suite('Workbench editor groups', () => {
|
||||
const group = createGroup();
|
||||
const events = groupListener(group);
|
||||
|
||||
const input1 = input();
|
||||
const input2 = input();
|
||||
const input3 = input();
|
||||
const input1 = input('1');
|
||||
const input1Copy = input('1');
|
||||
const input2 = input('2');
|
||||
const input3 = input('3');
|
||||
|
||||
// Pinned and Active
|
||||
group.openEditor(input1, { pinned: true, active: true });
|
||||
let openedEditor = group.openEditor(input1, { pinned: true, active: true });
|
||||
assert.equal(openedEditor, input1);
|
||||
|
||||
openedEditor = group.openEditor(input1Copy, { pinned: true, active: true }); // opening copy of editor should still return existing one
|
||||
assert.equal(openedEditor, input1);
|
||||
|
||||
group.openEditor(input2, { pinned: true, active: true });
|
||||
group.openEditor(input3, { pinned: true, active: true });
|
||||
|
||||
@@ -427,11 +452,33 @@ suite('Workbench editor groups', () => {
|
||||
assert.equal(events.opened[1], input2);
|
||||
assert.equal(events.opened[2], input3);
|
||||
|
||||
assert.equal(events.activated[0], input1);
|
||||
assert.equal(events.activated[1], input2);
|
||||
assert.equal(events.activated[2], input3);
|
||||
|
||||
const mru = group.getEditors(true);
|
||||
assert.equal(mru[0], input3);
|
||||
assert.equal(mru[1], input2);
|
||||
assert.equal(mru[2], input1);
|
||||
|
||||
// Add some tests where a matching input is used
|
||||
// and verify that events carry the original input
|
||||
const sameInput1 = input('1');
|
||||
group.openEditor(sameInput1, { pinned: true, active: true });
|
||||
assert.equal(events.activated[3], input1);
|
||||
|
||||
group.unpin(sameInput1);
|
||||
assert.equal(events.unpinned[0], input1);
|
||||
|
||||
group.pin(sameInput1);
|
||||
assert.equal(events.pinned[0], input1);
|
||||
|
||||
group.moveEditor(sameInput1, 1);
|
||||
assert.equal(events.moved[0], input1);
|
||||
|
||||
group.closeEditor(sameInput1);
|
||||
assert.equal(events.closed[0].editor, input1);
|
||||
|
||||
group.closeAllEditors();
|
||||
|
||||
assert.equal(events.closed.length, 3);
|
||||
@@ -930,24 +977,36 @@ suite('Workbench editor groups', () => {
|
||||
const group = createGroup();
|
||||
|
||||
// [] -> /index.html/
|
||||
let indexHtml = input('index.html');
|
||||
group.openEditor(indexHtml);
|
||||
const indexHtml = input('index.html');
|
||||
let openedEditor = group.openEditor(indexHtml);
|
||||
assert.equal(openedEditor, indexHtml);
|
||||
assert.equal(group.activeEditor, indexHtml);
|
||||
assert.equal(group.previewEditor, indexHtml);
|
||||
assert.equal(group.getEditors()[0], indexHtml);
|
||||
assert.equal(group.count, 1);
|
||||
|
||||
// /index.html/ -> /index.html/
|
||||
const sameIndexHtml = input('index.html');
|
||||
openedEditor = group.openEditor(sameIndexHtml);
|
||||
assert.equal(openedEditor, indexHtml);
|
||||
assert.equal(group.activeEditor, indexHtml);
|
||||
assert.equal(group.previewEditor, indexHtml);
|
||||
assert.equal(group.getEditors()[0], indexHtml);
|
||||
assert.equal(group.count, 1);
|
||||
|
||||
// /index.html/ -> /style.css/
|
||||
let styleCss = input('style.css');
|
||||
group.openEditor(styleCss);
|
||||
const styleCss = input('style.css');
|
||||
openedEditor = group.openEditor(styleCss);
|
||||
assert.equal(openedEditor, styleCss);
|
||||
assert.equal(group.activeEditor, styleCss);
|
||||
assert.equal(group.previewEditor, styleCss);
|
||||
assert.equal(group.getEditors()[0], styleCss);
|
||||
assert.equal(group.count, 1);
|
||||
|
||||
// /style.css/ -> [/style.css/, test.js]
|
||||
let testJs = input('test.js');
|
||||
group.openEditor(testJs, { active: true, pinned: true });
|
||||
const testJs = input('test.js');
|
||||
openedEditor = group.openEditor(testJs, { active: true, pinned: true });
|
||||
assert.equal(openedEditor, testJs);
|
||||
assert.equal(group.previewEditor, styleCss);
|
||||
assert.equal(group.activeEditor, testJs);
|
||||
assert.equal(group.isPreview(styleCss), true);
|
||||
@@ -957,28 +1016,28 @@ suite('Workbench editor groups', () => {
|
||||
assert.equal(group.count, 2);
|
||||
|
||||
// [/style.css/, test.js] -> [test.js, /index.html/]
|
||||
indexHtml = input('index.html');
|
||||
group.openEditor(indexHtml, { active: true });
|
||||
assert.equal(group.activeEditor, indexHtml);
|
||||
assert.equal(group.previewEditor, indexHtml);
|
||||
assert.equal(group.isPreview(indexHtml), true);
|
||||
const indexHtml2 = input('index.html');
|
||||
group.openEditor(indexHtml2, { active: true });
|
||||
assert.equal(group.activeEditor, indexHtml2);
|
||||
assert.equal(group.previewEditor, indexHtml2);
|
||||
assert.equal(group.isPreview(indexHtml2), true);
|
||||
assert.equal(group.isPinned(testJs), true);
|
||||
assert.equal(group.getEditors()[0], testJs);
|
||||
assert.equal(group.getEditors()[1], indexHtml);
|
||||
assert.equal(group.getEditors()[1], indexHtml2);
|
||||
assert.equal(group.count, 2);
|
||||
|
||||
// make test.js active
|
||||
testJs = input('test.js');
|
||||
group.setActive(testJs);
|
||||
const testJs2 = input('test.js');
|
||||
group.setActive(testJs2);
|
||||
assert.equal(group.activeEditor, testJs);
|
||||
assert.equal(group.isActive(testJs), true);
|
||||
assert.equal(group.isActive(testJs2), true);
|
||||
assert.equal(group.count, 2);
|
||||
|
||||
// [test.js, /indexHtml/] -> [test.js, index.html]
|
||||
indexHtml = input('index.html');
|
||||
group.pin(indexHtml);
|
||||
assert.equal(group.isPinned(indexHtml), true);
|
||||
assert.equal(group.isPreview(indexHtml), false);
|
||||
const indexHtml3 = input('index.html');
|
||||
group.pin(indexHtml3);
|
||||
assert.equal(group.isPinned(indexHtml3), true);
|
||||
assert.equal(group.isPreview(indexHtml3), false);
|
||||
assert.equal(group.activeEditor, testJs);
|
||||
|
||||
// [test.js, index.html] -> [test.js, file.ts, index.html]
|
||||
@@ -1006,9 +1065,9 @@ suite('Workbench editor groups', () => {
|
||||
assert.ok(group.getEditors()[2].matches(indexHtml));
|
||||
|
||||
// make index.html active
|
||||
indexHtml = input('index.html');
|
||||
group.setActive(indexHtml);
|
||||
assert.equal(group.activeEditor, indexHtml);
|
||||
const indexHtml4 = input('index.html');
|
||||
group.setActive(indexHtml4);
|
||||
assert.equal(group.activeEditor, indexHtml2);
|
||||
|
||||
// [test.js, /other.ts/, index.html] -> [test.js, /other.ts/]
|
||||
group.closeEditor(indexHtml);
|
||||
|
||||
@@ -16,7 +16,7 @@ import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
import { ITextBufferFactory } from 'vs/editor/common/model';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { createTextBufferFactory } from 'vs/editor/common/model/textModel';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { TestTextResourcePropertiesService } from 'vs/workbench/test/workbenchTestServices';
|
||||
|
||||
class MyEditorModel extends EditorModel { }
|
||||
@@ -74,4 +74,4 @@ suite('Workbench editor model', () => {
|
||||
instantiationService.stub(ITextResourcePropertiesService, new TestTextResourcePropertiesService(instantiationService.get(IConfigurationService)));
|
||||
return instantiationService.createInstance(ModelServiceImpl);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -54,11 +54,20 @@ suite('Workbench untitled text editors', () => {
|
||||
|
||||
assert.equal(service.getAll().length, 0);
|
||||
|
||||
let createdResources: URI[] = [];
|
||||
const createListener = service.onDidCreate(resource => {
|
||||
createdResources.push(resource);
|
||||
});
|
||||
|
||||
const input1 = service.createOrGet();
|
||||
assert.equal(input1, service.createOrGet(input1.getResource()));
|
||||
|
||||
assert.ok(service.exists(input1.getResource()));
|
||||
assert.ok(!service.exists(URI.file('testing')));
|
||||
assert.equal(createdResources.length, 1);
|
||||
assert.equal(createdResources[0].toString(), input1.getResource());
|
||||
|
||||
createListener.dispose();
|
||||
|
||||
const input2 = service.createOrGet();
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ suite('ExtHostTreeView', function () {
|
||||
rpcProtocol,
|
||||
new NullLogService()
|
||||
), new NullLogService());
|
||||
onDidChangeTreeNode = new Emitter<{ key: string }>();
|
||||
onDidChangeTreeNode = new Emitter<{ key: string } | undefined>();
|
||||
onDidChangeTreeNodeWithId = new Emitter<{ key: string }>();
|
||||
testObject.createTreeView('testNodeTreeProvider', { treeDataProvider: aNodeTreeDataProvider() }, { enableProposedApi: true } as IExtensionDescription);
|
||||
testObject.createTreeView('testNodeWithIdTreeProvider', { treeDataProvider: aNodeWithIdTreeDataProvider() }, { enableProposedApi: true } as IExtensionDescription);
|
||||
|
||||
@@ -63,7 +63,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.WORKSPACE });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', undefined);
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', undefined, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
@@ -72,7 +72,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', URI.file('abc'));
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
@@ -81,7 +81,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', undefined);
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', undefined, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
@@ -90,7 +90,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.WORKSPACE });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', undefined);
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', undefined, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
@@ -99,7 +99,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.WORKSPACE });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', URI.file('abc'));
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
@@ -108,7 +108,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', URI.file('abc'));
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
@@ -117,7 +117,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', undefined);
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', undefined, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
@@ -126,7 +126,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.WORKSPACE });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', URI.file('abc'));
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE_FOLDER, target.args[0][3]);
|
||||
});
|
||||
@@ -135,7 +135,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$updateConfigurationOption(ConfigurationTarget.USER, 'extHostConfiguration.window', 'value', URI.file('abc'));
|
||||
testObject.$updateConfigurationOption(ConfigurationTarget.USER, 'extHostConfiguration.window', 'value', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.USER, target.args[0][3]);
|
||||
});
|
||||
@@ -144,7 +144,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$updateConfigurationOption(ConfigurationTarget.WORKSPACE, 'extHostConfiguration.window', 'value', URI.file('abc'));
|
||||
testObject.$updateConfigurationOption(ConfigurationTarget.WORKSPACE, 'extHostConfiguration.window', 'value', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
@@ -153,7 +153,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$updateConfigurationOption(ConfigurationTarget.WORKSPACE_FOLDER, 'extHostConfiguration.window', 'value', URI.file('abc'));
|
||||
testObject.$updateConfigurationOption(ConfigurationTarget.WORKSPACE_FOLDER, 'extHostConfiguration.window', 'value', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE_FOLDER, target.args[0][3]);
|
||||
});
|
||||
@@ -162,7 +162,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.WORKSPACE });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', undefined);
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', undefined, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
@@ -171,7 +171,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', URI.file('abc'));
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
@@ -180,7 +180,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', undefined);
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', undefined, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
@@ -189,7 +189,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.WORKSPACE });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', undefined);
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', undefined, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
@@ -198,7 +198,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.WORKSPACE });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', URI.file('abc'));
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
@@ -207,7 +207,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', URI.file('abc'));
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
@@ -216,7 +216,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.FOLDER });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', undefined);
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', undefined, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
@@ -225,7 +225,7 @@ suite('MainThreadConfiguration', function () {
|
||||
instantiationService.stub(IWorkspaceContextService, <IWorkspaceContextService>{ getWorkbenchState: () => WorkbenchState.WORKSPACE });
|
||||
const testObject: MainThreadConfiguration = instantiationService.createInstance(MainThreadConfiguration, SingleProxyRPCProtocol(proxy));
|
||||
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', URI.file('abc'));
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE_FOLDER, target.args[0][3]);
|
||||
});
|
||||
|
||||
@@ -28,6 +28,7 @@ import { IReference, ImmortalReference } from 'vs/base/common/lifecycle';
|
||||
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
|
||||
import { LabelService } from 'vs/workbench/services/label/common/labelService';
|
||||
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
|
||||
import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService';
|
||||
|
||||
suite('MainThreadEditors', () => {
|
||||
|
||||
@@ -89,7 +90,11 @@ suite('MainThreadEditors', () => {
|
||||
}
|
||||
};
|
||||
|
||||
const bulkEditService = new BulkEditService(new NullLogService(), modelService, new TestEditorService(), textModelService, new TestFileService(), textFileService, new LabelService(TestEnvironmentService, new TestContextService()), configService);
|
||||
const editorWorkerService = new class extends mock<IEditorWorkerService>() {
|
||||
|
||||
};
|
||||
|
||||
const bulkEditService = new BulkEditService(new NullLogService(), modelService, new TestEditorService(), editorWorkerService, textModelService, new TestFileService(), textFileService, new LabelService(TestEnvironmentService, new TestContextService()), configService);
|
||||
|
||||
const rpcProtocol = new TestRPCProtocol();
|
||||
rpcProtocol.set(ExtHostContext.ExtHostDocuments, new class extends mock<ExtHostDocumentsShape>() {
|
||||
|
||||
@@ -10,7 +10,7 @@ import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
|
||||
@@ -32,7 +32,7 @@ import { QueryBuilder, ITextQueryBuilderOptions } from 'vs/workbench/contrib/sea
|
||||
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 { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
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';
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ import * as resources from 'vs/base/common/resources';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { IEditorInputWithOptions, CloseDirection, IEditorIdentifier, IUntitledTextResourceInput, IResourceDiffInput, IResourceSideBySideInput, IEditorInput, IEditor, IEditorCloseEvent, IEditorPartOptions, IRevertOptions } from 'vs/workbench/common/editor';
|
||||
import { IEditorOpeningEvent, EditorServiceImpl, IEditorGroupView } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { IEditorInputWithOptions, CloseDirection, IEditorIdentifier, IUntitledTextResourceInput, IResourceDiffInput, IResourceSideBySideInput, IEditorInput, IEditor, IEditorCloseEvent, IEditorPartOptions, IRevertOptions, GroupIdentifier } from 'vs/workbench/common/editor';
|
||||
import { IEditorOpeningEvent, EditorServiceImpl, IEditorGroupView, IEditorGroupsAccessor } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { IBackupFileService, IResolvedBackup } from 'vs/workbench/services/backup/common/backup';
|
||||
@@ -33,7 +33,7 @@ import { ITextFileStreamContent, ITextFileService, IResourceEncoding, IReadTextF
|
||||
import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { IHistoryService } from 'vs/workbench/services/history/common/history';
|
||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IInstantiationService, ServicesAccessor, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { MenuBarVisibility, IWindowConfiguration, IWindowOpenable, IOpenWindowOptions, IOpenEmptyWindowOptions, IOpenedWindow } from 'vs/platform/windows/common/windows';
|
||||
import { TestWorkspace } from 'vs/platform/workspace/test/common/testWorkspace';
|
||||
@@ -42,7 +42,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
|
||||
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IResourceConfigurationService, ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { ITextResourceConfigurationService, ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { IPosition, Position as EditorPosition } from 'vs/editor/common/core/position';
|
||||
import { IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
@@ -69,7 +69,7 @@ import { timeout } from 'vs/base/common/async';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { ViewletDescriptor, Viewlet } from 'vs/workbench/browser/viewlet';
|
||||
import { IViewlet } from 'vs/workbench/common/viewlet';
|
||||
import { IStorageService, InMemoryStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IStorageService, InMemoryStorageService, IWillSaveStateEvent } from 'vs/platform/storage/common/storage';
|
||||
import { isLinux, isMacintosh } from 'vs/base/common/platform';
|
||||
import { LabelService } from 'vs/workbench/services/label/common/labelService';
|
||||
import { IDimension } from 'vs/platform/layout/browser/layoutService';
|
||||
@@ -94,6 +94,7 @@ import { IDialogMainService } from 'vs/platform/dialogs/electron-main/dialogs';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { WorkingCopyService, IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
|
||||
import { IFilesConfigurationService, FilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
|
||||
import { IAccessibilityService, AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility';
|
||||
|
||||
export function createFileInput(instantiationService: IInstantiationService, resource: URI): FileEditorInput {
|
||||
return instantiationService.createInstance(FileEditorInput, resource, undefined, undefined);
|
||||
@@ -102,7 +103,7 @@ export function createFileInput(instantiationService: IInstantiationService, res
|
||||
export const TestEnvironmentService = new NativeWorkbenchEnvironmentService(parseArgs(process.argv, OPTIONS) as IWindowConfiguration, process.execPath, 0);
|
||||
|
||||
export class TestContextService implements IWorkspaceContextService {
|
||||
public _serviceBrand: undefined;
|
||||
_serviceBrand: undefined;
|
||||
|
||||
private workspace: Workspace;
|
||||
private options: any;
|
||||
@@ -119,23 +120,23 @@ export class TestContextService implements IWorkspaceContextService {
|
||||
this._onDidChangeWorkbenchState = new Emitter<WorkbenchState>();
|
||||
}
|
||||
|
||||
public get onDidChangeWorkspaceName(): Event<void> {
|
||||
get onDidChangeWorkspaceName(): Event<void> {
|
||||
return this._onDidChangeWorkspaceName.event;
|
||||
}
|
||||
|
||||
public get onDidChangeWorkspaceFolders(): Event<IWorkspaceFoldersChangeEvent> {
|
||||
get onDidChangeWorkspaceFolders(): Event<IWorkspaceFoldersChangeEvent> {
|
||||
return this._onDidChangeWorkspaceFolders.event;
|
||||
}
|
||||
|
||||
public get onDidChangeWorkbenchState(): Event<WorkbenchState> {
|
||||
get onDidChangeWorkbenchState(): Event<WorkbenchState> {
|
||||
return this._onDidChangeWorkbenchState.event;
|
||||
}
|
||||
|
||||
public getFolders(): IWorkspaceFolder[] {
|
||||
getFolders(): IWorkspaceFolder[] {
|
||||
return this.workspace ? this.workspace.folders : [];
|
||||
}
|
||||
|
||||
public getWorkbenchState(): WorkbenchState {
|
||||
getWorkbenchState(): WorkbenchState {
|
||||
if (this.workspace.configuration) {
|
||||
return WorkbenchState.WORKSPACE;
|
||||
}
|
||||
@@ -151,27 +152,27 @@ export class TestContextService implements IWorkspaceContextService {
|
||||
return Promise.resolve(this.getWorkspace());
|
||||
}
|
||||
|
||||
public getWorkspace(): IWorkbenchWorkspace {
|
||||
getWorkspace(): IWorkbenchWorkspace {
|
||||
return this.workspace;
|
||||
}
|
||||
|
||||
public getWorkspaceFolder(resource: URI): IWorkspaceFolder | null {
|
||||
getWorkspaceFolder(resource: URI): IWorkspaceFolder | null {
|
||||
return this.workspace.getFolder(resource);
|
||||
}
|
||||
|
||||
public setWorkspace(workspace: any): void {
|
||||
setWorkspace(workspace: any): void {
|
||||
this.workspace = workspace;
|
||||
}
|
||||
|
||||
public getOptions() {
|
||||
getOptions() {
|
||||
return this.options;
|
||||
}
|
||||
|
||||
public updateOptions() {
|
||||
updateOptions() {
|
||||
|
||||
}
|
||||
|
||||
public isInsideWorkspace(resource: URI): boolean {
|
||||
isInsideWorkspace(resource: URI): boolean {
|
||||
if (resource && this.workspace) {
|
||||
return resources.isEqualOrParent(resource, this.workspace.folders[0].uri);
|
||||
}
|
||||
@@ -179,17 +180,17 @@ export class TestContextService implements IWorkspaceContextService {
|
||||
return false;
|
||||
}
|
||||
|
||||
public toResource(workspaceRelativePath: string): URI {
|
||||
toResource(workspaceRelativePath: string): URI {
|
||||
return URI.file(join('C:\\', workspaceRelativePath));
|
||||
}
|
||||
|
||||
public isCurrentWorkspace(workspaceIdentifier: ISingleFolderWorkspaceIdentifier | IWorkspaceIdentifier): boolean {
|
||||
isCurrentWorkspace(workspaceIdentifier: ISingleFolderWorkspaceIdentifier | IWorkspaceIdentifier): boolean {
|
||||
return isSingleFolderWorkspaceIdentifier(workspaceIdentifier) && resources.isEqual(this.workspace.folders[0].uri, workspaceIdentifier);
|
||||
}
|
||||
}
|
||||
|
||||
export class TestTextFileService extends NativeTextFileService {
|
||||
public cleanupBackupsBeforeShutdownCalled!: boolean;
|
||||
cleanupBackupsBeforeShutdownCalled!: boolean;
|
||||
|
||||
private promptPath!: URI;
|
||||
private resolveTextContentError!: FileOperationError | null;
|
||||
@@ -209,7 +210,7 @@ export class TestTextFileService extends NativeTextFileService {
|
||||
@IDialogService dialogService: IDialogService,
|
||||
@IFileDialogService fileDialogService: IFileDialogService,
|
||||
@IEditorService editorService: IEditorService,
|
||||
@IResourceConfigurationService textResourceConfigurationService: IResourceConfigurationService,
|
||||
@ITextResourceConfigurationService textResourceConfigurationService: ITextResourceConfigurationService,
|
||||
@IElectronService electronService: IElectronService,
|
||||
@IProductService productService: IProductService,
|
||||
@IFilesConfigurationService filesConfigurationService: IFilesConfigurationService
|
||||
@@ -236,15 +237,15 @@ export class TestTextFileService extends NativeTextFileService {
|
||||
);
|
||||
}
|
||||
|
||||
public setPromptPath(path: URI): void {
|
||||
setPromptPath(path: URI): void {
|
||||
this.promptPath = path;
|
||||
}
|
||||
|
||||
public setResolveTextContentErrorOnce(error: FileOperationError): void {
|
||||
setResolveTextContentErrorOnce(error: FileOperationError): void {
|
||||
this.resolveTextContentError = error;
|
||||
}
|
||||
|
||||
public readStream(resource: URI, options?: IReadTextFileOptions): Promise<ITextFileStreamContent> {
|
||||
readStream(resource: URI, options?: IReadTextFileOptions): Promise<ITextFileStreamContent> {
|
||||
if (this.resolveTextContentError) {
|
||||
const error = this.resolveTextContentError;
|
||||
this.resolveTextContentError = null;
|
||||
@@ -266,7 +267,7 @@ export class TestTextFileService extends NativeTextFileService {
|
||||
});
|
||||
}
|
||||
|
||||
public promptForPath(_resource: URI, _defaultPath: URI): Promise<URI> {
|
||||
promptForPath(_resource: URI, _defaultPath: URI): Promise<URI> {
|
||||
return Promise.resolve(this.promptPath);
|
||||
}
|
||||
|
||||
@@ -276,7 +277,11 @@ export class TestTextFileService extends NativeTextFileService {
|
||||
}
|
||||
}
|
||||
|
||||
export function workbenchInstantiationService(): IInstantiationService {
|
||||
export interface ITestInstantiationService extends IInstantiationService {
|
||||
stub<T>(service: ServiceIdentifier<T>, ctor: any): T;
|
||||
}
|
||||
|
||||
export function workbenchInstantiationService(): ITestInstantiationService {
|
||||
let instantiationService = new TestInstantiationService(new ServiceCollection([ILifecycleService, new TestLifecycleService()]));
|
||||
instantiationService.stub(IEnvironmentService, TestEnvironmentService);
|
||||
const contextKeyService = <IContextKeyService>instantiationService.createInstance(MockContextKeyService);
|
||||
@@ -286,11 +291,12 @@ export function workbenchInstantiationService(): IInstantiationService {
|
||||
const configService = new TestConfigurationService();
|
||||
instantiationService.stub(IConfigurationService, configService);
|
||||
instantiationService.stub(IFilesConfigurationService, new TestFilesConfigurationService(contextKeyService, configService, TestEnvironmentService));
|
||||
instantiationService.stub(IResourceConfigurationService, new TestTextResourceConfigurationService(configService));
|
||||
instantiationService.stub(ITextResourceConfigurationService, new TestTextResourceConfigurationService(configService));
|
||||
instantiationService.stub(IUntitledTextEditorService, instantiationService.createInstance(UntitledTextEditorService));
|
||||
instantiationService.stub(IStorageService, new TestStorageService());
|
||||
instantiationService.stub(IWorkbenchLayoutService, new TestLayoutService());
|
||||
instantiationService.stub(IDialogService, new TestDialogService());
|
||||
instantiationService.stub(IAccessibilityService, new TestAccessibilityService());
|
||||
instantiationService.stub(IFileDialogService, new TestFileDialogService());
|
||||
instantiationService.stub(IElectronService, new TestElectronService());
|
||||
instantiationService.stub(IModeService, instantiationService.createInstance(ModeServiceImpl));
|
||||
@@ -311,7 +317,7 @@ export function workbenchInstantiationService(): IInstantiationService {
|
||||
instantiationService.stub(ITextModelService, <ITextModelService>instantiationService.createInstance(TextModelResolverService));
|
||||
instantiationService.stub(IThemeService, new TestThemeService());
|
||||
instantiationService.stub(ILogService, new NullLogService());
|
||||
instantiationService.stub(IEditorGroupsService, new TestEditorGroupsService([new TestEditorGroup(0)]));
|
||||
instantiationService.stub(IEditorGroupsService, new TestEditorGroupsService([new TestEditorGroupView(0)]));
|
||||
instantiationService.stub(ILabelService, <ILabelService>instantiationService.createInstance(LabelService));
|
||||
const editorService = new TestEditorService();
|
||||
instantiationService.stub(IEditorService, editorService);
|
||||
@@ -322,6 +328,17 @@ export function workbenchInstantiationService(): IInstantiationService {
|
||||
return instantiationService;
|
||||
}
|
||||
|
||||
export class TestAccessibilityService implements IAccessibilityService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
|
||||
onDidChangeAccessibilitySupport = Event.None;
|
||||
|
||||
alwaysUnderlineAccessKeys(): Promise<boolean> { return Promise.resolve(false); }
|
||||
getAccessibilitySupport(): AccessibilitySupport { return AccessibilitySupport.Unknown; }
|
||||
setAccessibilitySupport(accessibilitySupport: AccessibilitySupport): void { }
|
||||
}
|
||||
|
||||
export class TestDecorationsService implements IDecorationsService {
|
||||
_serviceBrand: undefined;
|
||||
onDidChangeDecorations: Event<IResourceDecorationChangeEvent> = Event.None;
|
||||
@@ -333,7 +350,7 @@ export class TestExtensionService extends NullExtensionService { }
|
||||
|
||||
export class TestMenuService implements IMenuService {
|
||||
|
||||
public _serviceBrand: undefined;
|
||||
_serviceBrand: undefined;
|
||||
|
||||
createMenu(_id: MenuId, _scopedKeybindingService: IContextKeyService): IMenu {
|
||||
return {
|
||||
@@ -346,112 +363,90 @@ export class TestMenuService implements IMenuService {
|
||||
|
||||
export class TestHistoryService implements IHistoryService {
|
||||
|
||||
public _serviceBrand: undefined;
|
||||
_serviceBrand: undefined;
|
||||
|
||||
constructor(private root?: URI) {
|
||||
}
|
||||
constructor(private root?: URI) { }
|
||||
|
||||
public reopenLastClosedEditor(): void {
|
||||
}
|
||||
|
||||
public forward(_acrossEditors?: boolean): void {
|
||||
}
|
||||
|
||||
public back(_acrossEditors?: boolean): void {
|
||||
}
|
||||
|
||||
public last(): void {
|
||||
}
|
||||
|
||||
public remove(_input: IEditorInput | IResourceInput): void {
|
||||
}
|
||||
|
||||
public clear(): void {
|
||||
}
|
||||
|
||||
public clearRecentlyOpened(): void {
|
||||
}
|
||||
|
||||
public getHistory(): Array<IEditorInput | IResourceInput> {
|
||||
return [];
|
||||
}
|
||||
|
||||
public getLastActiveWorkspaceRoot(_schemeFilter: string): URI | undefined {
|
||||
return this.root;
|
||||
}
|
||||
|
||||
public getLastActiveFile(_schemeFilter: string): URI | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public openLastEditLocation(): void {
|
||||
}
|
||||
reopenLastClosedEditor(): void { }
|
||||
forward(): void { }
|
||||
back(): void { }
|
||||
last(): void { }
|
||||
remove(_input: IEditorInput | IResourceInput): void { }
|
||||
clear(): void { }
|
||||
clearRecentlyOpened(): void { }
|
||||
getHistory(): Array<IEditorInput | IResourceInput> { return []; }
|
||||
openNextRecentlyUsedEditor(group?: GroupIdentifier): void { }
|
||||
openPreviouslyUsedEditor(group?: GroupIdentifier): void { }
|
||||
getMostRecentlyUsedOpenEditors(): Array<IEditorIdentifier> { return []; }
|
||||
getLastActiveWorkspaceRoot(_schemeFilter: string): URI | undefined { return this.root; }
|
||||
getLastActiveFile(_schemeFilter: string): URI | undefined { return undefined; }
|
||||
openLastEditLocation(): void { }
|
||||
}
|
||||
|
||||
export class TestDialogService implements IDialogService {
|
||||
|
||||
public _serviceBrand: undefined;
|
||||
_serviceBrand: undefined;
|
||||
|
||||
public confirm(_confirmation: IConfirmation): Promise<IConfirmationResult> {
|
||||
confirm(_confirmation: IConfirmation): Promise<IConfirmationResult> {
|
||||
return Promise.resolve({ confirmed: false });
|
||||
}
|
||||
|
||||
public show(_severity: Severity, _message: string, _buttons: string[], _options?: IDialogOptions): Promise<IShowResult> {
|
||||
show(_severity: Severity, _message: string, _buttons: string[], _options?: IDialogOptions): Promise<IShowResult> {
|
||||
return Promise.resolve({ choice: 0 });
|
||||
}
|
||||
|
||||
public about(): Promise<void> {
|
||||
about(): Promise<void> {
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
export class TestFileDialogService implements IFileDialogService {
|
||||
|
||||
public _serviceBrand: undefined;
|
||||
_serviceBrand: undefined;
|
||||
|
||||
private confirmResult!: ConfirmResult;
|
||||
|
||||
public defaultFilePath(_schemeFilter?: string): URI | undefined {
|
||||
defaultFilePath(_schemeFilter?: string): URI | undefined {
|
||||
return undefined;
|
||||
}
|
||||
public defaultFolderPath(_schemeFilter?: string): URI | undefined {
|
||||
defaultFolderPath(_schemeFilter?: string): URI | undefined {
|
||||
return undefined;
|
||||
}
|
||||
public defaultWorkspacePath(_schemeFilter?: string): URI | undefined {
|
||||
defaultWorkspacePath(_schemeFilter?: string): URI | undefined {
|
||||
return undefined;
|
||||
}
|
||||
public pickFileFolderAndOpen(_options: IPickAndOpenOptions): Promise<any> {
|
||||
pickFileFolderAndOpen(_options: IPickAndOpenOptions): Promise<any> {
|
||||
return Promise.resolve(0);
|
||||
}
|
||||
public pickFileAndOpen(_options: IPickAndOpenOptions): Promise<any> {
|
||||
pickFileAndOpen(_options: IPickAndOpenOptions): Promise<any> {
|
||||
return Promise.resolve(0);
|
||||
}
|
||||
public pickFolderAndOpen(_options: IPickAndOpenOptions): Promise<any> {
|
||||
pickFolderAndOpen(_options: IPickAndOpenOptions): Promise<any> {
|
||||
return Promise.resolve(0);
|
||||
}
|
||||
public pickWorkspaceAndOpen(_options: IPickAndOpenOptions): Promise<any> {
|
||||
pickWorkspaceAndOpen(_options: IPickAndOpenOptions): Promise<any> {
|
||||
return Promise.resolve(0);
|
||||
}
|
||||
public pickFileToSave(_options: ISaveDialogOptions): Promise<URI | undefined> {
|
||||
pickFileToSave(_options: ISaveDialogOptions): Promise<URI | undefined> {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
public showSaveDialog(_options: ISaveDialogOptions): Promise<URI | undefined> {
|
||||
showSaveDialog(_options: ISaveDialogOptions): Promise<URI | undefined> {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
public showOpenDialog(_options: IOpenDialogOptions): Promise<URI[] | undefined> {
|
||||
showOpenDialog(_options: IOpenDialogOptions): Promise<URI[] | undefined> {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
public setConfirmResult(result: ConfirmResult): void {
|
||||
setConfirmResult(result: ConfirmResult): void {
|
||||
this.confirmResult = result;
|
||||
}
|
||||
public showSaveConfirm(fileNamesOrResources: (string | URI)[]): Promise<ConfirmResult> {
|
||||
showSaveConfirm(fileNamesOrResources: (string | URI)[]): Promise<ConfirmResult> {
|
||||
return Promise.resolve(this.confirmResult);
|
||||
}
|
||||
}
|
||||
|
||||
export class TestLayoutService implements IWorkbenchLayoutService {
|
||||
|
||||
public _serviceBrand: undefined;
|
||||
_serviceBrand: undefined;
|
||||
|
||||
dimension: IDimension = { width: 800, height: 600 };
|
||||
|
||||
@@ -467,27 +462,27 @@ export class TestLayoutService implements IWorkbenchLayoutService {
|
||||
|
||||
private readonly _onMenubarVisibilityChange = new Emitter<Dimension>();
|
||||
|
||||
public get onMenubarVisibilityChange(): Event<Dimension> {
|
||||
get onMenubarVisibilityChange(): Event<Dimension> {
|
||||
return this._onMenubarVisibilityChange.event;
|
||||
}
|
||||
|
||||
public isRestored(): boolean {
|
||||
isRestored(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
public hasFocus(_part: Parts): boolean {
|
||||
hasFocus(_part: Parts): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public hasWindowBorder(): boolean {
|
||||
hasWindowBorder(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public getWindowBorderRadius(): string | undefined {
|
||||
getWindowBorderRadius(): string | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public isVisible(_part: Parts): boolean {
|
||||
isVisible(_part: Parts): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -495,93 +490,93 @@ export class TestLayoutService implements IWorkbenchLayoutService {
|
||||
return new Dimension(0, 0);
|
||||
}
|
||||
|
||||
public getContainer(_part: Parts): HTMLElement {
|
||||
getContainer(_part: Parts): HTMLElement {
|
||||
return null!;
|
||||
}
|
||||
|
||||
public isTitleBarHidden(): boolean {
|
||||
isTitleBarHidden(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public getTitleBarOffset(): number {
|
||||
getTitleBarOffset(): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public isStatusBarHidden(): boolean {
|
||||
isStatusBarHidden(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public isActivityBarHidden(): boolean {
|
||||
isActivityBarHidden(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public setActivityBarHidden(_hidden: boolean): void { }
|
||||
setActivityBarHidden(_hidden: boolean): void { }
|
||||
|
||||
public isSideBarHidden(): boolean {
|
||||
isSideBarHidden(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public setEditorHidden(_hidden: boolean): Promise<void> { return Promise.resolve(); }
|
||||
setEditorHidden(_hidden: boolean): Promise<void> { return Promise.resolve(); }
|
||||
|
||||
public setSideBarHidden(_hidden: boolean): Promise<void> { return Promise.resolve(); }
|
||||
setSideBarHidden(_hidden: boolean): Promise<void> { return Promise.resolve(); }
|
||||
|
||||
public isPanelHidden(): boolean {
|
||||
isPanelHidden(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public setPanelHidden(_hidden: boolean): Promise<void> { return Promise.resolve(); }
|
||||
setPanelHidden(_hidden: boolean): Promise<void> { return Promise.resolve(); }
|
||||
|
||||
public toggleMaximizedPanel(): void { }
|
||||
toggleMaximizedPanel(): void { }
|
||||
|
||||
public isPanelMaximized(): boolean {
|
||||
isPanelMaximized(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public getMenubarVisibility(): MenuBarVisibility {
|
||||
getMenubarVisibility(): MenuBarVisibility {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
|
||||
public getSideBarPosition() {
|
||||
getSideBarPosition() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public getPanelPosition() {
|
||||
getPanelPosition() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public setPanelPosition(_position: PartPosition): Promise<void> {
|
||||
setPanelPosition(_position: PartPosition): Promise<void> {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
public addClass(_clazz: string): void { }
|
||||
public removeClass(_clazz: string): void { }
|
||||
addClass(_clazz: string): void { }
|
||||
removeClass(_clazz: string): void { }
|
||||
|
||||
public getMaximumEditorDimensions(): Dimension { throw new Error('not implemented'); }
|
||||
getMaximumEditorDimensions(): Dimension { throw new Error('not implemented'); }
|
||||
|
||||
public getWorkbenchContainer(): HTMLElement { throw new Error('not implemented'); }
|
||||
public getWorkbenchElement(): HTMLElement { throw new Error('not implemented'); }
|
||||
getWorkbenchContainer(): HTMLElement { throw new Error('not implemented'); }
|
||||
getWorkbenchElement(): HTMLElement { throw new Error('not implemented'); }
|
||||
|
||||
public toggleZenMode(): void { }
|
||||
toggleZenMode(): void { }
|
||||
|
||||
public isEditorLayoutCentered(): boolean { return false; }
|
||||
public centerEditorLayout(_active: boolean): void { }
|
||||
isEditorLayoutCentered(): boolean { return false; }
|
||||
centerEditorLayout(_active: boolean): void { }
|
||||
|
||||
|
||||
public resizePart(_part: Parts, _sizeChange: number): void { }
|
||||
resizePart(_part: Parts, _sizeChange: number): void { }
|
||||
|
||||
public registerPart(part: Part): void { }
|
||||
registerPart(part: Part): void { }
|
||||
|
||||
isWindowMaximized() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public updateWindowMaximizedState(maximized: boolean): void { }
|
||||
updateWindowMaximizedState(maximized: boolean): void { }
|
||||
}
|
||||
|
||||
let activeViewlet: Viewlet = {} as any;
|
||||
|
||||
export class TestViewletService implements IViewletService {
|
||||
public _serviceBrand: undefined;
|
||||
_serviceBrand: undefined;
|
||||
|
||||
onDidViewletRegisterEmitter = new Emitter<ViewletDescriptor>();
|
||||
onDidViewletDeregisterEmitter = new Emitter<ViewletDescriptor>();
|
||||
@@ -593,97 +588,100 @@ export class TestViewletService implements IViewletService {
|
||||
onDidViewletOpen = this.onDidViewletOpenEmitter.event;
|
||||
onDidViewletClose = this.onDidViewletCloseEmitter.event;
|
||||
|
||||
public openViewlet(id: string, focus?: boolean): Promise<IViewlet | undefined> {
|
||||
openViewlet(id: string, focus?: boolean): Promise<IViewlet | undefined> {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
public getViewlets(): ViewletDescriptor[] {
|
||||
getViewlets(): ViewletDescriptor[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
public getAllViewlets(): ViewletDescriptor[] {
|
||||
getAllViewlets(): ViewletDescriptor[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
public getActiveViewlet(): IViewlet {
|
||||
getActiveViewlet(): IViewlet {
|
||||
return activeViewlet;
|
||||
}
|
||||
|
||||
public dispose() {
|
||||
dispose() {
|
||||
}
|
||||
|
||||
public getDefaultViewletId(): string {
|
||||
getDefaultViewletId(): string {
|
||||
return 'workbench.view.explorer';
|
||||
}
|
||||
|
||||
public getViewlet(id: string): ViewletDescriptor | undefined {
|
||||
getViewlet(id: string): ViewletDescriptor | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public getProgressIndicator(id: string) {
|
||||
getProgressIndicator(id: string) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public hideActiveViewlet(): void { }
|
||||
hideActiveViewlet(): void { }
|
||||
|
||||
public getLastActiveViewletId(): string {
|
||||
getLastActiveViewletId(): string {
|
||||
return undefined!;
|
||||
}
|
||||
}
|
||||
|
||||
export class TestPanelService implements IPanelService {
|
||||
public _serviceBrand: undefined;
|
||||
_serviceBrand: undefined;
|
||||
|
||||
onDidPanelOpen = new Emitter<{ panel: IPanel, focus: boolean }>().event;
|
||||
onDidPanelClose = new Emitter<IPanel>().event;
|
||||
|
||||
public openPanel(id: string, focus?: boolean): undefined {
|
||||
openPanel(id: string, focus?: boolean): undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public getPanel(id: string): any {
|
||||
getPanel(id: string): any {
|
||||
return activeViewlet;
|
||||
}
|
||||
|
||||
public getPanels() {
|
||||
getPanels() {
|
||||
return [];
|
||||
}
|
||||
|
||||
public getPinnedPanels() {
|
||||
getPinnedPanels() {
|
||||
return [];
|
||||
}
|
||||
|
||||
public getActivePanel(): IViewlet {
|
||||
getActivePanel(): IViewlet {
|
||||
return activeViewlet;
|
||||
}
|
||||
|
||||
public setPanelEnablement(id: string, enabled: boolean): void { }
|
||||
setPanelEnablement(id: string, enabled: boolean): void { }
|
||||
|
||||
public dispose() {
|
||||
dispose() {
|
||||
}
|
||||
|
||||
public showActivity(panelId: string, badge: IBadge, clazz?: string): IDisposable {
|
||||
showActivity(panelId: string, badge: IBadge, clazz?: string): IDisposable {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
public getProgressIndicator(id: string) {
|
||||
getProgressIndicator(id: string) {
|
||||
return null!;
|
||||
}
|
||||
|
||||
public hideActivePanel(): void { }
|
||||
hideActivePanel(): void { }
|
||||
|
||||
public getLastActivePanelId(): string {
|
||||
getLastActivePanelId(): string {
|
||||
return undefined!;
|
||||
}
|
||||
}
|
||||
|
||||
export class TestStorageService extends InMemoryStorageService { }
|
||||
export class TestStorageService extends InMemoryStorageService {
|
||||
readonly _onWillSaveState = this._register(new Emitter<IWillSaveStateEvent>());
|
||||
readonly onWillSaveState = this._onWillSaveState.event;
|
||||
}
|
||||
|
||||
export class TestEditorGroupsService implements IEditorGroupsService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
|
||||
constructor(public groups: TestEditorGroup[] = []) { }
|
||||
constructor(public groups: TestEditorGroupView[] = []) { }
|
||||
|
||||
onDidActiveGroupChange: Event<IEditorGroup> = Event.None;
|
||||
onDidActivateGroup: Event<IEditorGroup> = Event.None;
|
||||
@@ -773,7 +771,7 @@ export class TestEditorGroupsService implements IEditorGroupsService {
|
||||
}
|
||||
}
|
||||
|
||||
export class TestEditorGroup implements IEditorGroupView {
|
||||
export class TestEditorGroupView implements IEditorGroupView {
|
||||
|
||||
constructor(public id: number) { }
|
||||
|
||||
@@ -825,7 +823,7 @@ export class TestEditorGroup implements IEditorGroupView {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
|
||||
isOpened(_editor: IEditorInput): boolean {
|
||||
isOpened(_editor: IEditorInput | IResourceInput): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -873,6 +871,28 @@ export class TestEditorGroup implements IEditorGroupView {
|
||||
relayout() { }
|
||||
}
|
||||
|
||||
export class TestEditorGroupAccessor implements IEditorGroupsAccessor {
|
||||
|
||||
groups: IEditorGroupView[] = [];
|
||||
activeGroup!: IEditorGroupView;
|
||||
|
||||
partOptions: IEditorPartOptions = {};
|
||||
|
||||
onDidEditorPartOptionsChange = Event.None;
|
||||
onDidVisibilityChange = Event.None;
|
||||
|
||||
getGroup(identifier: number): IEditorGroupView | undefined { throw new Error('Method not implemented.'); }
|
||||
getGroups(order: GroupsOrder): IEditorGroupView[] { throw new Error('Method not implemented.'); }
|
||||
activateGroup(identifier: number | IEditorGroupView): IEditorGroupView { throw new Error('Method not implemented.'); }
|
||||
restoreGroup(identifier: number | IEditorGroupView): IEditorGroupView { throw new Error('Method not implemented.'); }
|
||||
addGroup(location: number | IEditorGroupView, direction: GroupDirection, options?: IAddGroupOptions | undefined): IEditorGroupView { throw new Error('Method not implemented.'); }
|
||||
mergeGroup(group: number | IEditorGroupView, target: number | IEditorGroupView, options?: IMergeGroupOptions | undefined): IEditorGroupView { throw new Error('Method not implemented.'); }
|
||||
moveGroup(group: number | IEditorGroupView, location: number | IEditorGroupView, direction: GroupDirection): IEditorGroupView { throw new Error('Method not implemented.'); }
|
||||
copyGroup(group: number | IEditorGroupView, location: number | IEditorGroupView, direction: GroupDirection): IEditorGroupView { throw new Error('Method not implemented.'); }
|
||||
removeGroup(group: number | IEditorGroupView): void { throw new Error('Method not implemented.'); }
|
||||
arrangeGroups(arrangement: GroupsArrangement, target?: number | IEditorGroupView | undefined): void { throw new Error('Method not implemented.'); }
|
||||
}
|
||||
|
||||
export class TestEditorService implements EditorServiceImpl {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
@@ -941,7 +961,7 @@ export class TestEditorService implements EditorServiceImpl {
|
||||
|
||||
export class TestFileService implements IFileService {
|
||||
|
||||
public _serviceBrand: undefined;
|
||||
_serviceBrand: undefined;
|
||||
|
||||
private readonly _onFileChanges: Emitter<FileChangesEvent>;
|
||||
private readonly _onAfterOperation: Emitter<FileOperationEvent>;
|
||||
@@ -957,31 +977,31 @@ export class TestFileService implements IFileService {
|
||||
this._onAfterOperation = new Emitter<FileOperationEvent>();
|
||||
}
|
||||
|
||||
public setContent(content: string): void {
|
||||
setContent(content: string): void {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public getContent(): string {
|
||||
getContent(): string {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public getLastReadFileUri(): URI {
|
||||
getLastReadFileUri(): URI {
|
||||
return this.lastReadFileUri;
|
||||
}
|
||||
|
||||
public get onFileChanges(): Event<FileChangesEvent> {
|
||||
get onFileChanges(): Event<FileChangesEvent> {
|
||||
return this._onFileChanges.event;
|
||||
}
|
||||
|
||||
public fireFileChanges(event: FileChangesEvent): void {
|
||||
fireFileChanges(event: FileChangesEvent): void {
|
||||
this._onFileChanges.fire(event);
|
||||
}
|
||||
|
||||
public get onAfterOperation(): Event<FileOperationEvent> {
|
||||
get onAfterOperation(): Event<FileOperationEvent> {
|
||||
return this._onAfterOperation.event;
|
||||
}
|
||||
|
||||
public fireAfterOperation(event: FileOperationEvent): void {
|
||||
fireAfterOperation(event: FileOperationEvent): void {
|
||||
this._onAfterOperation.fire(event);
|
||||
}
|
||||
|
||||
@@ -1119,21 +1139,21 @@ export class TestFileService implements IFileService {
|
||||
}
|
||||
|
||||
export class TestBackupFileService implements IBackupFileService {
|
||||
public _serviceBrand: undefined;
|
||||
_serviceBrand: undefined;
|
||||
|
||||
public hasBackups(): Promise<boolean> {
|
||||
hasBackups(): Promise<boolean> {
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
|
||||
public hasBackup(_resource: URI): Promise<boolean> {
|
||||
hasBackup(_resource: URI): Promise<boolean> {
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
|
||||
public hasBackupSync(resource: URI, versionId?: number): boolean {
|
||||
hasBackupSync(resource: URI, versionId?: number): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public loadBackupResource(resource: URI): Promise<URI | undefined> {
|
||||
loadBackupResource(resource: URI): Promise<URI | undefined> {
|
||||
return this.hasBackup(resource).then(hasBackup => {
|
||||
if (hasBackup) {
|
||||
return this.toBackupResource(resource);
|
||||
@@ -1143,42 +1163,42 @@ export class TestBackupFileService implements IBackupFileService {
|
||||
});
|
||||
}
|
||||
|
||||
public registerResourceForBackup(_resource: URI): Promise<void> {
|
||||
registerResourceForBackup(_resource: URI): Promise<void> {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
public deregisterResourceForBackup(_resource: URI): Promise<void> {
|
||||
deregisterResourceForBackup(_resource: URI): Promise<void> {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
public toBackupResource(_resource: URI): URI {
|
||||
toBackupResource(_resource: URI): URI {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
|
||||
public backupResource<T extends object>(_resource: URI, _content: ITextSnapshot, versionId?: number, meta?: T): Promise<void> {
|
||||
backupResource<T extends object>(_resource: URI, _content: ITextSnapshot, versionId?: number, meta?: T): Promise<void> {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
public getWorkspaceFileBackups(): Promise<URI[]> {
|
||||
getWorkspaceFileBackups(): Promise<URI[]> {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
public parseBackupContent(textBufferFactory: ITextBufferFactory): string {
|
||||
parseBackupContent(textBufferFactory: ITextBufferFactory): string {
|
||||
const textBuffer = textBufferFactory.create(DefaultEndOfLine.LF);
|
||||
const lineCount = textBuffer.getLineCount();
|
||||
const range = new Range(1, 1, lineCount, textBuffer.getLineLength(lineCount) + 1);
|
||||
return textBuffer.getValueInRange(range, EndOfLinePreference.TextDefined);
|
||||
}
|
||||
|
||||
public resolveBackupContent<T extends object>(_backup: URI): Promise<IResolvedBackup<T>> {
|
||||
resolveBackupContent<T extends object>(_backup: URI): Promise<IResolvedBackup<T>> {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
|
||||
public discardResourceBackup(_resource: URI): Promise<void> {
|
||||
discardResourceBackup(_resource: URI): Promise<void> {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
public discardAllWorkspaceBackups(): Promise<void> {
|
||||
discardAllWorkspaceBackups(): Promise<void> {
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
@@ -1210,10 +1230,10 @@ export class TestCodeEditorService implements ICodeEditorService {
|
||||
|
||||
export class TestLifecycleService implements ILifecycleService {
|
||||
|
||||
public _serviceBrand: undefined;
|
||||
_serviceBrand: undefined;
|
||||
|
||||
public phase!: LifecyclePhase;
|
||||
public startupKind!: StartupKind;
|
||||
phase!: LifecyclePhase;
|
||||
startupKind!: StartupKind;
|
||||
|
||||
private readonly _onBeforeShutdown = new Emitter<BeforeShutdownEvent>();
|
||||
private readonly _onWillShutdown = new Emitter<WillShutdownEvent>();
|
||||
@@ -1223,38 +1243,38 @@ export class TestLifecycleService implements ILifecycleService {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
public fireShutdown(reason = ShutdownReason.QUIT): void {
|
||||
fireShutdown(reason = ShutdownReason.QUIT): void {
|
||||
this._onWillShutdown.fire({
|
||||
join: () => { },
|
||||
reason
|
||||
});
|
||||
}
|
||||
|
||||
public fireWillShutdown(event: BeforeShutdownEvent): void {
|
||||
fireWillShutdown(event: BeforeShutdownEvent): void {
|
||||
this._onBeforeShutdown.fire(event);
|
||||
}
|
||||
|
||||
public get onBeforeShutdown(): Event<BeforeShutdownEvent> {
|
||||
get onBeforeShutdown(): Event<BeforeShutdownEvent> {
|
||||
return this._onBeforeShutdown.event;
|
||||
}
|
||||
|
||||
public get onWillShutdown(): Event<WillShutdownEvent> {
|
||||
get onWillShutdown(): Event<WillShutdownEvent> {
|
||||
return this._onWillShutdown.event;
|
||||
}
|
||||
|
||||
public get onShutdown(): Event<void> {
|
||||
get onShutdown(): Event<void> {
|
||||
return this._onShutdown.event;
|
||||
}
|
||||
}
|
||||
|
||||
export class TestTextResourceConfigurationService implements IResourceConfigurationService {
|
||||
export class TestTextResourceConfigurationService implements ITextResourceConfigurationService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
|
||||
constructor(private configurationService = new TestConfigurationService()) {
|
||||
}
|
||||
|
||||
public onDidChangeConfiguration() {
|
||||
onDidChangeConfiguration() {
|
||||
return { dispose() { } };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user