diff --git a/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts b/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts index 49ef23f954b..ff8fbd105f6 100644 --- a/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts +++ b/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts @@ -34,7 +34,7 @@ export const COMMENTEDITOR_DECORATION_KEY = 'commenteditordecoration'; export class CommentThreadWidget extends Disposable implements ICommentThreadWidget { private _header!: CommentThreadHeader; - private _body!: CommentThreadBody; + private _body: CommentThreadBody; private _commentReply?: CommentReply; private _additionalActions?: CommentThreadAdditionalActions; private _commentMenus: CommentMenus; @@ -274,7 +274,7 @@ export class CommentThreadWidget extends } getDimensions() { - return this._body?.getDimensions(); + return this._body.getDimensions(); } layout(widthInPixel?: number) { diff --git a/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.ts b/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.ts index 26c40b04385..3de6392331c 100644 --- a/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.ts +++ b/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.ts @@ -416,8 +416,12 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget this._commentThreadWidget.submitComment(); } - _refresh(dimensions?: dom.Dimension) { - if (this._isExpanded && dimensions) { + _refresh(dimensions: dom.Dimension) { + if (dimensions.height === 0 && dimensions.width === 0) { + this.commentThread.collapsibleState = languages.CommentThreadCollapsibleState.Collapsed; + return; + } + if (this._isExpanded) { this._commentThreadWidget.layout(); const headHeight = Math.ceil(this.editor.getOption(EditorOption.lineHeight) * 1.2);