From 13583577d9687171e4812c21acf27ac755a71009 Mon Sep 17 00:00:00 2001 From: Peng Lyu Date: Wed, 27 Mar 2019 10:03:44 -0700 Subject: [PATCH] Fix Microsoft/vscode-pull-request-github#1080. Only rerender the widget when the position changed. --- .../contrib/comments/browser/commentThreadWidget.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts b/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts index e218f1147ec..14de703eec6 100644 --- a/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts +++ b/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts @@ -291,8 +291,10 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget // Move comment glyph widget and show position if the line has changed. const lineNumber = this._commentThread.range.startLineNumber; + let shouldMoveWidget = false; if (this._commentGlyph) { if (this._commentGlyph.getPosition().position!.lineNumber !== lineNumber) { + shouldMoveWidget = true; this._commentGlyph.setLineNumber(lineNumber); } } @@ -301,7 +303,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget this.createReplyButton(); } - if (!this._isCollapsed) { + if (shouldMoveWidget && !this._isCollapsed) { this.show({ lineNumber, column: 1 }, 2); } } @@ -451,13 +453,15 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget this._disposables.push((this._commentThread as modes.CommentThread2).onDidChangeRange(range => { // Move comment glyph widget and show position if the line has changed. const lineNumber = this._commentThread.range.startLineNumber; + let shouldMoveWidget = false; if (this._commentGlyph) { if (this._commentGlyph.getPosition().position!.lineNumber !== lineNumber) { + shouldMoveWidget = true; this._commentGlyph.setLineNumber(lineNumber); } } - if (!this._isCollapsed) { + if (shouldMoveWidget && !this._isCollapsed) { this.show({ lineNumber, column: 1 }, 2); } }));