mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-09 17:52:34 -05:00
Merge from vscode 7eaf220cafb9d9e901370ffce02229171cbf3ea6
This commit is contained in:
committed by
Anthony Dresser
parent
39d9eed585
commit
a63578e6f7
@@ -6,17 +6,18 @@
|
||||
import { EditorInput } from 'vs/workbench/common/editor';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
|
||||
import { IConstructorSignature0, IInstantiationService, BrandedService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { insert } from 'vs/base/common/arrays';
|
||||
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
export interface IEditorDescriptor {
|
||||
instantiate(instantiationService: IInstantiationService): BaseEditor;
|
||||
|
||||
getId(): string;
|
||||
getName(): string;
|
||||
|
||||
instantiate(instantiationService: IInstantiationService): EditorPane;
|
||||
|
||||
describes(obj: unknown): boolean;
|
||||
}
|
||||
|
||||
@@ -56,20 +57,20 @@ export interface IEditorRegistry {
|
||||
export class EditorDescriptor implements IEditorDescriptor {
|
||||
|
||||
static create<Services extends BrandedService[]>(
|
||||
ctor: { new(...services: Services): BaseEditor },
|
||||
ctor: { new(...services: Services): EditorPane },
|
||||
id: string,
|
||||
name: string
|
||||
): EditorDescriptor {
|
||||
return new EditorDescriptor(ctor as IConstructorSignature0<BaseEditor>, id, name);
|
||||
return new EditorDescriptor(ctor as IConstructorSignature0<EditorPane>, id, name);
|
||||
}
|
||||
|
||||
constructor(
|
||||
private readonly ctor: IConstructorSignature0<BaseEditor>,
|
||||
private readonly ctor: IConstructorSignature0<EditorPane>,
|
||||
private readonly id: string,
|
||||
private readonly name: string
|
||||
) { }
|
||||
|
||||
instantiate(instantiationService: IInstantiationService): BaseEditor {
|
||||
instantiate(instantiationService: IInstantiationService): EditorPane {
|
||||
return instantiationService.createInstance(this.ctor);
|
||||
}
|
||||
|
||||
@@ -82,7 +83,7 @@ export class EditorDescriptor implements IEditorDescriptor {
|
||||
}
|
||||
|
||||
describes(obj: unknown): boolean {
|
||||
return obj instanceof BaseEditor && obj.getId() === this.id;
|
||||
return obj instanceof EditorPane && obj.getId() === this.id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user