mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Refresh master with initial release/0.24 snapshot (#332)
* Initial port of release/0.24 source code * Fix additional headers * Fix a typo in launch.json
This commit is contained in:
@@ -6,10 +6,7 @@
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import * as Platform from 'vs/platform/registry/common/platform';
|
||||
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
|
||||
import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { Extensions, IWorkbenchActionRegistry } from 'vs/workbench/common/actionRegistry';
|
||||
import { prepareActions } from 'vs/workbench/browser/actions';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
|
||||
@@ -22,26 +19,6 @@ class MyClass extends Action {
|
||||
|
||||
suite('Workbench Action Registry', () => {
|
||||
|
||||
test('Workbench Action Registration', function () {
|
||||
let Registry = <IWorkbenchActionRegistry>Platform.Registry.as(Extensions.WorkbenchActions);
|
||||
|
||||
let d = new SyncActionDescriptor(MyClass, 'id', 'name');
|
||||
|
||||
let oldActions = Registry.getWorkbenchActions().slice(0);
|
||||
let oldCount = Registry.getWorkbenchActions().length;
|
||||
|
||||
Registry.registerWorkbenchAction(d, 'My Alias', 'category');
|
||||
Registry.registerWorkbenchAction(d, null);
|
||||
|
||||
assert.equal(Registry.getWorkbenchActions().length, 1 + oldCount);
|
||||
assert.strictEqual(d, Registry.getWorkbenchAction('id'));
|
||||
|
||||
assert.deepEqual(Registry.getAlias(d.id), 'My Alias');
|
||||
assert.equal(Registry.getCategory(d.id), 'category');
|
||||
|
||||
(<any>Registry).setWorkbenchActions(oldActions);
|
||||
});
|
||||
|
||||
test('Workbench Action Bar prepareActions()', function () {
|
||||
let a1 = new Separator();
|
||||
let a2 = new Separator();
|
||||
@@ -57,4 +34,4 @@ suite('Workbench Action Registry', () => {
|
||||
assert(actions[1] === a5);
|
||||
assert(actions[2] === a6);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,27 +6,29 @@
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { BaseEditor, EditorDescriptor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { EditorInput, EditorOptions, Extensions, IEditorRegistry, IEditorInputFactory } from 'vs/workbench/common/editor';
|
||||
import { BaseEditor } 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 { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
|
||||
import { workbenchInstantiationService } 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';
|
||||
|
||||
const NullThemeService = new TestThemeService();
|
||||
|
||||
let EditorRegistry: IEditorRegistry = Platform.Registry.as(Extensions.Editors);
|
||||
let EditorInputRegistry: IEditorInputFactoryRegistry = Platform.Registry.as(EditorExtensions.EditorInputFactories);
|
||||
|
||||
export class MyEditor extends BaseEditor {
|
||||
|
||||
constructor(id: string, @ITelemetryService telemetryService: ITelemetryService) {
|
||||
super(id, NullTelemetryService, NullThemeService);
|
||||
constructor( @ITelemetryService telemetryService: ITelemetryService) {
|
||||
super('MyEditor', NullTelemetryService, NullThemeService);
|
||||
}
|
||||
|
||||
getId(): string {
|
||||
@@ -44,8 +46,8 @@ export class MyEditor extends BaseEditor {
|
||||
|
||||
export class MyOtherEditor extends BaseEditor {
|
||||
|
||||
constructor(id: string, @ITelemetryService telemetryService: ITelemetryService) {
|
||||
super(id, NullTelemetryService, NullThemeService);
|
||||
constructor( @ITelemetryService telemetryService: ITelemetryService) {
|
||||
super('myOtherEditor', NullTelemetryService, NullThemeService);
|
||||
}
|
||||
|
||||
getId(): string {
|
||||
@@ -100,7 +102,7 @@ class MyResourceInput extends ResourceEditorInput { }
|
||||
suite('Workbench BaseEditor', () => {
|
||||
|
||||
test('BaseEditor API', function (done) {
|
||||
let e = new MyEditor('id', NullTelemetryService);
|
||||
let e = new MyEditor(NullTelemetryService);
|
||||
let input = new MyOtherInput();
|
||||
let options = new EditorOptions();
|
||||
|
||||
@@ -127,14 +129,14 @@ suite('Workbench BaseEditor', () => {
|
||||
});
|
||||
|
||||
test('EditorDescriptor', function () {
|
||||
let d = new EditorDescriptor('id', 'name', 'vs/workbench/test/browser/parts/editor/baseEditor.test', 'MyClass');
|
||||
let d = new EditorDescriptor(MyEditor, 'id', 'name');
|
||||
assert.strictEqual(d.getId(), 'id');
|
||||
assert.strictEqual(d.getName(), 'name');
|
||||
});
|
||||
|
||||
test('Editor Registration', function () {
|
||||
let d1 = new EditorDescriptor('id1', 'name', 'vs/workbench/test/browser/parts/editor/baseEditor.test', 'MyClass');
|
||||
let d2 = new EditorDescriptor('id2', 'name', 'vs/workbench/test/browser/parts/editor/baseEditor.test', 'MyOtherClass');
|
||||
let d1 = new EditorDescriptor(MyEditor, 'id1', 'name');
|
||||
let d2 = new EditorDescriptor(MyOtherEditor, 'id2', 'name');
|
||||
|
||||
let oldEditorsCnt = EditorRegistry.getEditors().length;
|
||||
let oldInputCnt = (<any>EditorRegistry).getEditorInputs().length;
|
||||
@@ -153,9 +155,9 @@ suite('Workbench BaseEditor', () => {
|
||||
assert(!EditorRegistry.getEditorById('id3'));
|
||||
});
|
||||
|
||||
test('Editor Lookup favors specific class over superclass (match on specific class)', function (done) {
|
||||
let d1 = new EditorDescriptor('id1', 'name', 'vs/workbench/test/browser/parts/editor/baseEditor.test', 'MyEditor');
|
||||
let d2 = new EditorDescriptor('id2', 'name', 'vs/workbench/test/browser/parts/editor/baseEditor.test', 'MyOtherEditor');
|
||||
test('Editor Lookup favors specific class over superclass (match on specific class)', function () {
|
||||
let d1 = new EditorDescriptor(MyEditor, 'id1', 'name');
|
||||
let d2 = new EditorDescriptor(MyOtherEditor, 'id2', 'name');
|
||||
|
||||
let oldEditors = EditorRegistry.getEditors();
|
||||
(<any>EditorRegistry).setEditors([]);
|
||||
@@ -165,19 +167,17 @@ suite('Workbench BaseEditor', () => {
|
||||
|
||||
let inst = new TestInstantiationService();
|
||||
|
||||
inst.createInstance(EditorRegistry.getEditor(inst.createInstance(MyResourceInput, 'fake', '', '', PLAINTEXT_MODE_ID, false)), 'id').then(editor => {
|
||||
assert.strictEqual(editor.getId(), 'myEditor');
|
||||
const editor = EditorRegistry.getEditor(inst.createInstance(MyResourceInput, 'fake', '', URI.file('/fake'))).instantiate(inst);
|
||||
assert.strictEqual(editor.getId(), 'myEditor');
|
||||
|
||||
return inst.createInstance(EditorRegistry.getEditor(inst.createInstance(ResourceEditorInput, 'fake', '', '', PLAINTEXT_MODE_ID, false)), 'id').then(editor => {
|
||||
assert.strictEqual(editor.getId(), 'myOtherEditor');
|
||||
const otherEditor = EditorRegistry.getEditor(inst.createInstance(ResourceEditorInput, 'fake', '', URI.file('/fake'))).instantiate(inst);
|
||||
assert.strictEqual(otherEditor.getId(), 'myOtherEditor');
|
||||
|
||||
(<any>EditorRegistry).setEditors(oldEditors);
|
||||
});
|
||||
}).done(() => done());
|
||||
(<any>EditorRegistry).setEditors(oldEditors);
|
||||
});
|
||||
|
||||
test('Editor Lookup favors specific class over superclass (match on super class)', function (done) {
|
||||
let d1 = new EditorDescriptor('id1', 'name', 'vs/workbench/test/browser/parts/editor/baseEditor.test', 'MyOtherEditor');
|
||||
test('Editor Lookup favors specific class over superclass (match on super class)', function () {
|
||||
let d1 = new EditorDescriptor(MyOtherEditor, 'id1', 'name');
|
||||
|
||||
let oldEditors = EditorRegistry.getEditors();
|
||||
(<any>EditorRegistry).setEditors([]);
|
||||
@@ -186,18 +186,17 @@ suite('Workbench BaseEditor', () => {
|
||||
|
||||
let inst = new TestInstantiationService();
|
||||
|
||||
inst.createInstance(EditorRegistry.getEditor(inst.createInstance(MyResourceInput, 'fake', '', '', PLAINTEXT_MODE_ID, false)), 'id').then(editor => {
|
||||
assert.strictEqual('myOtherEditor', editor.getId());
|
||||
const editor = EditorRegistry.getEditor(inst.createInstance(MyResourceInput, 'fake', '', URI.file('/fake'))).instantiate(inst);
|
||||
assert.strictEqual('myOtherEditor', editor.getId());
|
||||
|
||||
(<any>EditorRegistry).setEditors(oldEditors);
|
||||
}).done(() => done());
|
||||
(<any>EditorRegistry).setEditors(oldEditors);
|
||||
});
|
||||
|
||||
test('Editor Input Factory', function () {
|
||||
EditorRegistry.setInstantiationService(workbenchInstantiationService());
|
||||
EditorRegistry.registerEditorInputFactory('myInputId', MyInputFactory);
|
||||
EditorInputRegistry.setInstantiationService(workbenchInstantiationService());
|
||||
EditorInputRegistry.registerEditorInputFactory('myInputId', MyInputFactory);
|
||||
|
||||
let factory = EditorRegistry.getEditorInputFactory('myInputId');
|
||||
let factory = EditorInputRegistry.getEditorInputFactory('myInputId');
|
||||
assert(factory);
|
||||
});
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { EditorStacksModel, EditorGroup, EditorCloseEvent } from 'vs/workbench/common/editor/editorStacksModel';
|
||||
import { EditorInput, IFileEditorInput, IEditorIdentifier, IEditorGroup, IStacksModelChangeEvent, IEditorRegistry, Extensions as EditorExtensions, IEditorInputFactory, IEditorCloseEvent } from 'vs/workbench/common/editor';
|
||||
import { Extensions as EditorExtensions, IEditorInputFactoryRegistry, EditorInput, IFileEditorInput, IEditorIdentifier, IEditorGroup, IStacksModelChangeEvent, IEditorInputFactory, IEditorCloseEvent } from 'vs/workbench/common/editor';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { TestStorageService, TestLifecycleService, TestContextService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
@@ -22,7 +22,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
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 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
|
||||
function create(): EditorStacksModel {
|
||||
let inst = new TestInstantiationService();
|
||||
@@ -202,7 +201,7 @@ class TestEditorInputFactory implements IEditorInputFactory {
|
||||
}
|
||||
}
|
||||
|
||||
(<IEditorRegistry>Registry.as(EditorExtensions.Editors)).registerEditorInputFactory('testEditorInput', TestEditorInputFactory);
|
||||
(<IEditorInputFactoryRegistry>Registry.as(EditorExtensions.EditorInputFactories)).registerEditorInputFactory('testEditorInput', TestEditorInputFactory);
|
||||
|
||||
suite('Editor Stacks Model', () => {
|
||||
|
||||
@@ -1199,7 +1198,7 @@ suite('Editor Stacks Model', () => {
|
||||
config.setUserConfiguration('workbench', { editor: { openPositioning: 'right' } });
|
||||
inst.stub(IConfigurationService, config);
|
||||
|
||||
(<IEditorRegistry>Registry.as(EditorExtensions.Editors)).setInstantiationService(inst);
|
||||
(<IEditorInputFactoryRegistry>Registry.as(EditorExtensions.EditorInputFactories)).setInstantiationService(inst);
|
||||
|
||||
let model: EditorStacksModel = inst.createInstance(EditorStacksModel, true);
|
||||
let group = model.openGroup('group');
|
||||
@@ -1244,7 +1243,7 @@ suite('Editor Stacks Model', () => {
|
||||
inst.stub(IConfigurationService, config);
|
||||
|
||||
|
||||
(<IEditorRegistry>Registry.as(EditorExtensions.Editors)).setInstantiationService(inst);
|
||||
(<IEditorInputFactoryRegistry>Registry.as(EditorExtensions.EditorInputFactories)).setInstantiationService(inst);
|
||||
|
||||
let model: EditorStacksModel = inst.createInstance(EditorStacksModel, true);
|
||||
|
||||
@@ -1327,7 +1326,7 @@ suite('Editor Stacks Model', () => {
|
||||
inst.stub(IConfigurationService, config);
|
||||
|
||||
|
||||
(<IEditorRegistry>Registry.as(EditorExtensions.Editors)).setInstantiationService(inst);
|
||||
(<IEditorInputFactoryRegistry>Registry.as(EditorExtensions.EditorInputFactories)).setInstantiationService(inst);
|
||||
|
||||
let model: EditorStacksModel = inst.createInstance(EditorStacksModel, true);
|
||||
|
||||
@@ -1378,7 +1377,7 @@ suite('Editor Stacks Model', () => {
|
||||
inst.stub(IConfigurationService, config);
|
||||
|
||||
|
||||
(<IEditorRegistry>Registry.as(EditorExtensions.Editors)).setInstantiationService(inst);
|
||||
(<IEditorInputFactoryRegistry>Registry.as(EditorExtensions.EditorInputFactories)).setInstantiationService(inst);
|
||||
|
||||
let model: EditorStacksModel = inst.createInstance(EditorStacksModel, true);
|
||||
|
||||
@@ -1419,7 +1418,7 @@ suite('Editor Stacks Model', () => {
|
||||
config.setUserConfiguration('workbench', { editor: { openPositioning: 'right' } });
|
||||
inst.stub(IConfigurationService, config);
|
||||
|
||||
(<IEditorRegistry>Registry.as(EditorExtensions.Editors)).setInstantiationService(inst);
|
||||
(<IEditorInputFactoryRegistry>Registry.as(EditorExtensions.EditorInputFactories)).setInstantiationService(inst);
|
||||
|
||||
let model: EditorStacksModel = inst.createInstance(EditorStacksModel, false);
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Promise, TPromise } from 'vs/base/common/winjs.base';
|
||||
import Event from 'vs/base/common/event';
|
||||
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { QuickOpenHandlerDescriptor, IQuickOpenRegistry, Extensions as QuickOpenExtensions, QuickOpenAction } from 'vs/workbench/browser/quickopen';
|
||||
import { QuickOpenHandlerDescriptor, IQuickOpenRegistry, Extensions as QuickOpenExtensions, QuickOpenAction, QuickOpenHandler } from 'vs/workbench/browser/quickopen';
|
||||
|
||||
export class TestQuickOpenService implements IQuickOpenService {
|
||||
public _serviceBrand: any;
|
||||
@@ -61,11 +61,15 @@ export class TestQuickOpenService implements IQuickOpenService {
|
||||
|
||||
suite('Workbench QuickOpen', () => {
|
||||
|
||||
class TestHandler extends QuickOpenHandler {
|
||||
|
||||
}
|
||||
|
||||
test('QuickOpen Handler and Registry', () => {
|
||||
let registry = (<IQuickOpenRegistry>Registry.as(QuickOpenExtensions.Quickopen));
|
||||
let handler = new QuickOpenHandlerDescriptor(
|
||||
'test',
|
||||
'TestHandler',
|
||||
TestHandler,
|
||||
'testhandler',
|
||||
',',
|
||||
'Handler',
|
||||
null
|
||||
|
||||
@@ -7,13 +7,24 @@
|
||||
|
||||
import * as assert from 'assert';
|
||||
import * as Platform from 'vs/platform/registry/common/platform';
|
||||
import { ViewletDescriptor, Extensions } from 'vs/workbench/browser/viewlet';
|
||||
import { ViewletDescriptor, Extensions, Viewlet } from 'vs/workbench/browser/viewlet';
|
||||
import * as Types from 'vs/base/common/types';
|
||||
|
||||
suite('Workbench Viewlet', () => {
|
||||
|
||||
class TestViewlet extends Viewlet {
|
||||
|
||||
constructor() {
|
||||
super('id', null, null);
|
||||
}
|
||||
|
||||
public layout(dimension: any): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
|
||||
test('ViewletDescriptor API', function () {
|
||||
let d = new ViewletDescriptor('moduleId', 'ctorName', 'id', 'name', 'class', 5);
|
||||
let d = new ViewletDescriptor(TestViewlet, 'id', 'name', 'class', 5);
|
||||
assert.strictEqual(d.id, 'id');
|
||||
assert.strictEqual(d.name, 'name');
|
||||
assert.strictEqual(d.cssClass, 'class');
|
||||
@@ -21,11 +32,11 @@ suite('Workbench Viewlet', () => {
|
||||
});
|
||||
|
||||
test('Editor Aware ViewletDescriptor API', function () {
|
||||
let d = new ViewletDescriptor('moduleId', 'ctorName', 'id', 'name', 'class', 5);
|
||||
let d = new ViewletDescriptor(TestViewlet, 'id', 'name', 'class', 5);
|
||||
assert.strictEqual(d.id, 'id');
|
||||
assert.strictEqual(d.name, 'name');
|
||||
|
||||
d = new ViewletDescriptor('moduleId', 'ctorName', 'id', 'name', 'class', 5);
|
||||
d = new ViewletDescriptor(TestViewlet, 'id', 'name', 'class', 5);
|
||||
assert.strictEqual(d.id, 'id');
|
||||
assert.strictEqual(d.name, 'name');
|
||||
});
|
||||
@@ -36,7 +47,7 @@ suite('Workbench Viewlet', () => {
|
||||
assert(Types.isFunction(Platform.Registry.as(Extensions.Viewlets).getViewlets));
|
||||
|
||||
let oldCount = Platform.Registry.as(Extensions.Viewlets).getViewlets().length;
|
||||
let d = new ViewletDescriptor('moduleId', 'ctorName', 'reg-test-id', 'name');
|
||||
let d = new ViewletDescriptor(TestViewlet, 'reg-test-id', 'name');
|
||||
Platform.Registry.as(Extensions.Viewlets).registerViewlet(d);
|
||||
|
||||
assert(d === Platform.Registry.as(Extensions.Viewlets).getViewlet('reg-test-id'));
|
||||
|
||||
Reference in New Issue
Block a user