Skip to content

Commit 4270de1

Browse files
authored
Fix initial comment expand state (microsoft#180941)
Fixes microsoft#169928
1 parent a7cfec3 commit 4270de1

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const COMMENTEDITOR_DECORATION_KEY = 'commenteditordecoration';
3434

3535
export class CommentThreadWidget<T extends IRange | ICellRange = IRange> extends Disposable implements ICommentThreadWidget {
3636
private _header!: CommentThreadHeader<T>;
37-
private _body!: CommentThreadBody<T>;
37+
private _body: CommentThreadBody<T>;
3838
private _commentReply?: CommentReply<T>;
3939
private _additionalActions?: CommentThreadAdditionalActions<T>;
4040
private _commentMenus: CommentMenus;
@@ -274,7 +274,7 @@ export class CommentThreadWidget<T extends IRange | ICellRange = IRange> extends
274274
}
275275

276276
getDimensions() {
277-
return this._body?.getDimensions();
277+
return this._body.getDimensions();
278278
}
279279

280280
layout(widthInPixel?: number) {

src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,12 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
416416
this._commentThreadWidget.submitComment();
417417
}
418418

419-
_refresh(dimensions?: dom.Dimension) {
420-
if (this._isExpanded && dimensions) {
419+
_refresh(dimensions: dom.Dimension) {
420+
if (dimensions.height === 0 && dimensions.width === 0) {
421+
this.commentThread.collapsibleState = languages.CommentThreadCollapsibleState.Collapsed;
422+
return;
423+
}
424+
if (this._isExpanded) {
421425
this._commentThreadWidget.layout();
422426

423427
const headHeight = Math.ceil(this.editor.getOption(EditorOption.lineHeight) * 1.2);

0 commit comments

Comments
 (0)