mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -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);
|
||||
|
||||
@@ -697,15 +697,13 @@ export class ChoiceAction extends Action {
|
||||
private readonly _keepOpen: boolean;
|
||||
|
||||
constructor(id: string, choice: IPromptChoice) {
|
||||
super(id, choice.label, undefined, true, () => {
|
||||
super(id, choice.label, undefined, true, async () => {
|
||||
|
||||
// Pass to runner
|
||||
choice.run();
|
||||
|
||||
// Emit Event
|
||||
this._onDidRun.fire();
|
||||
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
this._keepOpen = !!choice.keepOpen;
|
||||
|
||||
Reference in New Issue
Block a user