From c1cbd4909947fd3b3ba5212ea22f550be8d7cc67 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Tue, 23 Jan 2024 09:56:18 +0100 Subject: [PATCH] Editor scroll position jumps up when returning to editor (#203013) Fixes #202811 --- .../contrib/comments/browser/commentThreadZoneWidget.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.ts b/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.ts index 4784d1c38c566..e5ae9040d5096 100644 --- a/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.ts +++ b/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.ts @@ -25,6 +25,7 @@ import { ICellRange } from 'vs/workbench/contrib/notebook/common/notebookRange'; import { commentThreadStateBackgroundColorVar, commentThreadStateColorVar, getCommentThreadStateBorderColor } from 'vs/workbench/contrib/comments/browser/commentColors'; import { peekViewBorder } from 'vs/editor/contrib/peekView/browser/peekView'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { StableEditorScrollState } from 'vs/editor/browser/stableEditorScroll'; function getCommentThreadWidgetStateColor(thread: languages.CommentThreadState | undefined, theme: IColorTheme): Color | undefined { return getCommentThreadStateBorderColor(thread, theme) ?? theme.getColor(peekViewBorder); @@ -453,7 +454,9 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget this._commentThreadWidget.focusCommentEditor(); } + const capture = StableEditorScrollState.capture(this.editor); this._relayout(computedLinesNumber); + capture.restore(this.editor); } }