mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-14 03:58:33 -05:00
Merge from vscode 073a24de05773f2261f89172987002dc0ae2f1cd (#9711)
This commit is contained in:
@@ -168,6 +168,10 @@ export interface IFileEditorInputFactory {
|
||||
isFileEditorInput(obj: unknown): obj is IFileEditorInput;
|
||||
}
|
||||
|
||||
interface ICustomEditorInputFactory {
|
||||
createCustomEditorInput(resource: URI, instantiationService: IInstantiationService): Promise<IEditorInput>;
|
||||
}
|
||||
|
||||
export interface IEditorInputFactoryRegistry {
|
||||
|
||||
/**
|
||||
@@ -180,6 +184,16 @@ export interface IEditorInputFactoryRegistry {
|
||||
*/
|
||||
getFileEditorInputFactory(): IFileEditorInputFactory;
|
||||
|
||||
/**
|
||||
* Registers the custom editor input factory to use for custom inputs.
|
||||
*/
|
||||
registerCustomEditorInputFactory(factory: ICustomEditorInputFactory): void;
|
||||
|
||||
/**
|
||||
* Returns the custom editor input factory to use for custom inputs.
|
||||
*/
|
||||
getCustomEditorInputFactory(): ICustomEditorInputFactory;
|
||||
|
||||
/**
|
||||
* Registers a editor input factory for the given editor input to the registry. An editor input factory
|
||||
* is capable of serializing and deserializing editor inputs from string data.
|
||||
@@ -1387,6 +1401,7 @@ export interface IEditorMemento<T> {
|
||||
class EditorInputFactoryRegistry implements IEditorInputFactoryRegistry {
|
||||
private instantiationService: IInstantiationService | undefined;
|
||||
private fileEditorInputFactory: IFileEditorInputFactory | undefined;
|
||||
private customEditorInputFactory: ICustomEditorInputFactory | undefined;
|
||||
|
||||
private readonly editorInputFactoryConstructors: Map<string, IConstructorSignature0<IEditorInputFactory>> = new Map();
|
||||
private readonly editorInputFactoryInstances: Map<string, IEditorInputFactory> = new Map();
|
||||
@@ -1414,6 +1429,14 @@ class EditorInputFactoryRegistry implements IEditorInputFactoryRegistry {
|
||||
return assertIsDefined(this.fileEditorInputFactory);
|
||||
}
|
||||
|
||||
registerCustomEditorInputFactory(factory: ICustomEditorInputFactory): void {
|
||||
this.customEditorInputFactory = factory;
|
||||
}
|
||||
|
||||
getCustomEditorInputFactory(): ICustomEditorInputFactory {
|
||||
return assertIsDefined(this.customEditorInputFactory);
|
||||
}
|
||||
|
||||
registerEditorInputFactory(editorInputId: string, ctor: IConstructorSignature0<IEditorInputFactory>): IDisposable {
|
||||
if (!this.instantiationService) {
|
||||
this.editorInputFactoryConstructors.set(editorInputId, ctor);
|
||||
|
||||
Reference in New Issue
Block a user