editors - ensure setInput() always wire in the promise

This commit is contained in:
Benjamin Pasero committed 2018-06-11 17:24:24 +02:00
1 parent f7cc895901
commit 98d7de04d6
2 files changed
+5 -10

No files matched your search

@@ -107,7 +107,7 @@ export class SideBySideEditor extends BaseEditor {
return false;
}
private updateInput(oldInput: SideBySideEditorInput, newInput: SideBySideEditorInput, options: EditorOptions, token: CancellationToken): void {
private updateInput(oldInput: SideBySideEditorInput, newInput: SideBySideEditorInput, options: EditorOptions, token: CancellationToken): Thenable<void> {
if (!newInput.matches(oldInput)) {
if (oldInput) {
this.disposeEditors();
@@ -116,18 +116,15 @@ export class SideBySideEditor extends BaseEditor {
return this.setNewInput(newInput, options, token);
} else {
this.detailsEditor.setInput(newInput.details, null, token);
this.masterEditor.setInput(newInput.master, options, token);
return void 0;
return TPromise.join([this.detailsEditor.setInput(newInput.details, null, token), this.masterEditor.setInput(newInput.master, options, token)]).then(() => void 0);
}
}
private setNewInput(newInput: SideBySideEditorInput, options: EditorOptions, token: CancellationToken): void {
private setNewInput(newInput: SideBySideEditorInput, options: EditorOptions, token: CancellationToken): Thenable<void> {
const detailsEditor = this._createEditor(<EditorInput>newInput.details, this.detailsEditorContainer);
const masterEditor = this._createEditor(<EditorInput>newInput.master, this.masterEditorContainer);
this.onEditorsCreated(detailsEditor, masterEditor, newInput.details, newInput.master, options, token);
return this.onEditorsCreated(detailsEditor, masterEditor, newInput.details, newInput.master, options, token);
}
private _createEditor(editorInput: EditorInput, container: HTMLElement): BaseEditor {
@@ -111,9 +111,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
setInput(input: KeybindingsEditorInput, options: EditorOptions, token: CancellationToken): Thenable<void> {
return super.setInput(input, options, token)
.then(() => {
this.render(options && options.preserveFocus, token);
});
.then(() => this.render(options && options.preserveFocus, token));
}
clearInput(): void {