layout: add check

This commit is contained in:
Joao Moreno
2019-07-29 17:56:34 +02:00
parent e5d0413f85
commit 0b375ff86c
+6
View File
@@ -750,6 +750,12 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
workbenchGrid = SerializableGrid.deserialize(parsedGrid, { fromJSON }, { proportionalLayout: false });
const root = workbenchGrid.getViews();
const titleBarSection = root.children[0];
if (isGridBranchNode(titleBarSection) || titleBarSection.view !== this.titleBarPartView) {
throw new Error('Bad grid');
}
const middleSection = root.children[1] as GridBranchNode<ISerializableView>;
this.state.sideBar.position = (middleSection.children[0] as GridLeafNode<ISerializableView>).view === this.activityBarPartView ? Position.LEFT : Position.RIGHT;
this.state.panel.position = isGridBranchNode(middleSection.children[2]) ? Position.BOTTOM : Position.RIGHT;