diff --git a/src/sql/workbench/contrib/query/browser/queryEditor.ts b/src/sql/workbench/contrib/query/browser/queryEditor.ts index 8108a514da..f2fdb6bf04 100644 --- a/src/sql/workbench/contrib/query/browser/queryEditor.ts +++ b/src/sql/workbench/contrib/query/browser/queryEditor.ts @@ -342,6 +342,7 @@ export class QueryEditor extends EditorPane { } this.taskbar.setContent(content); + this.layout(this.dimension); } public override async setInput(newInput: QueryEditorInput, options: IEditorOptions, context: IEditorOpenContext, token: CancellationToken): Promise { @@ -507,10 +508,12 @@ export class QueryEditor extends EditorPane { * To be called when the container of this editor changes size. */ public layout(dimension: DOM.Dimension): void { - this.dimension = dimension; - const queryEditorHeight = dimension.height - DOM.getTotalHeight(this.taskbar.getContainer()); - this.splitviewContainer.style.height = queryEditorHeight + 'px'; - this.splitview.layout(queryEditorHeight); + if (dimension?.height && dimension?.width && this.splitview) { + this.dimension = dimension; + const queryEditorHeight = dimension.height - DOM.getTotalHeight(this.taskbar.getContainer()); + this.splitviewContainer.style.height = queryEditorHeight + 'px'; + this.splitview.layout(queryEditorHeight); + } } /**