set visible editors active property correctly.

This commit is contained in:
rebornix
2020-05-30 17:53:26 -07:00
parent 0663fac3ac
commit c2131f984e

View File

@@ -1173,7 +1173,7 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
}
if (delta.visibleEditors) {
this.visibleNotebookEditors = delta.visibleEditors.map(id => this._editors.get(id)?.editor).filter(editor => !!editor) as ExtHostNotebookEditor[];
this.visibleNotebookEditors = delta.visibleEditors.map(id => this._editors.get(id)!.editor).filter(editor => !!editor) as ExtHostNotebookEditor[];
const visibleEditorsSet = new Set<string>();
this.visibleNotebookEditors.forEach(editor => visibleEditorsSet.add(editor.id));
@@ -1191,18 +1191,23 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
this._activeNotebookEditor = this._editors.get(delta.newActiveEditor)?.editor;
this._activeNotebookEditor?._acceptActive(true);
this._activeNotebookDocument = this._activeNotebookEditor ? this._documents.get(this._activeNotebookEditor!.uri.toString()) : undefined;
[...this._editors.values()].forEach((e) => {
if (e.editor !== this.activeNotebookEditor) {
e.editor._acceptActive(false);
}
});
} else {
// clear active notebook as current active editor is non-notebook editor
this._activeNotebookEditor = undefined;
this._activeNotebookDocument = undefined;
[...this._editors.values()].forEach((e) => {
e.editor._acceptActive(false);
});
}
this._onDidChangeActiveNotebookEditor.fire(this._activeNotebookEditor);
}
[...this._editors.values()].forEach((e) => {
if (e.editor !== this.activeNotebookEditor) {
e.editor._acceptActive(false);
}
});
}
}