From 06800b8d779dd78e461b79f46eb6006df7a07f2b Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Fri, 26 Jul 2024 11:49:24 +0200 Subject: [PATCH] CommentController.activeCommentThread not updated when navigating from editor gutter Fixes #223824 --- .../contrib/comments/browser/commentThreadZoneWidget.ts | 5 ++++- .../workbench/contrib/comments/browser/commentsController.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.ts b/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.ts index da2c6539dfb6c..735fa356954c5 100644 --- a/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.ts +++ b/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.ts @@ -319,8 +319,11 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget this._commentThread.collapsibleState = languages.CommentThreadCollapsibleState.Collapsed; } - public expand() { + public expand(setActive?: boolean) { this._commentThread.collapsibleState = languages.CommentThreadCollapsibleState.Expanded; + if (setActive) { + this.commentService.setActiveCommentAndThread(this.uniqueOwner, { thread: this._commentThread }); + } } public getGlyphPosition(): number { diff --git a/src/vs/workbench/contrib/comments/browser/commentsController.ts b/src/vs/workbench/contrib/comments/browser/commentsController.ts index 09aeddd25e6a0..a3d8445ce13b5 100644 --- a/src/vs/workbench/contrib/comments/browser/commentsController.ts +++ b/src/vs/workbench/contrib/comments/browser/commentsController.ts @@ -1098,7 +1098,7 @@ export class CommentController implements IEditorContribution { const existingCommentsAtLine = this._commentWidgets.filter(widget => widget.getGlyphPosition() === (commentRange ? commentRange.endLineNumber : 0)); if (existingCommentsAtLine.length) { const allExpanded = existingCommentsAtLine.every(widget => widget.expanded); - existingCommentsAtLine.forEach(allExpanded ? widget => widget.collapse() : widget => widget.expand()); + existingCommentsAtLine.forEach(allExpanded ? widget => widget.collapse() : widget => widget.expand(true)); this.processNextThreadToAdd(); return; } else {