Change:
<!-- Do Not Delete This! bugreporttemplate --<!-- Please read our Rules of Conduct: --<!-- Read our guide about submitting issues: --<!-- Search existing issues to avoid creating duplicates. --<!-- Test using the latest Insiders build to see if your issue has already been fixed: --<!-- Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. --<!-- Launch with to check. --Does this issue occur when all extensions are disabled?: Yes (depends on language) <!-- If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. --<!-- Issues caused by an extension need to be reported directly to the extension publisher. The 'Help Report Issue' dialog can assist with this. --- VS Code Version: 1.68.0 OS Version: Windows/Linux (does not matter for this bug) The problem is, if you set the to higher value like 10, vscode will starts to scroll the editor if i open a peek editor with the or similar commands (even if the editor would easily fit in the remaining area under the active line). I use 100 as a value for the surrounding lines to keep the cursor vertically in the middle, so i dont need to scroll when i move between lines, but this way when i open any peek editor, vscode will scrolls the active line to the top. If the peek editor can fit under the active line, it should not scroll the editor. I tested this with python, c++, and javascript, so this scrolling issue is not caused by extensions. It works exactly the same way with all of these languages. With javascript it occures even if vscode was started with . Steps to Reproduce: Place this in your (or use the settings editor) a file that has functions in it. the command. active line will be scrolled to the top, no matter what. !
Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.68.0. Please try upgrading to the latest version and checking whether this issue remains. Happy Coding!
The peek widget reveal the line it and that causes the shift. Tho, when we would reveal the line above it would cut off the button of the peek widget. We might need a way to reveal a line without honouring the surrounding lines setting

Discussion:
const model = this.editor.getModel(); if (model) { <del> const revealLine = where.endLineNumber + 1; if (revealLine <= model.getLineCount()) { // reveal line below the zone widget this.revealLine(revealLine, false); } else { // reveal last line atop this.revealLine(model.getLineCount(), true); } </del> <ins> const range = model.validateRange(new Range(where.startLineNumber, 1, where.endLineNumber + 1, 1)); this.revealRange(range, range.endLineNumber === model.getLineCount()); </ins> } } <del> protected revealLine(lineNumber: number, isLastLine: boolean) { </del> <ins> protected revealRange(range: Range, isLastLine: boolean) { </ins> if (isLastLine) { <del> this.editor.revealLineInCenter(lineNumber, ScrollType.Smooth); </del> <ins> this.editor.revealLineNearTop(range.endLineNumber, ScrollType.Smooth); </ins> } else { <del> this.editor.revealLine(lineNumber, ScrollType.Smooth); </del> <ins> this.editor.revealRange(range, ScrollType.Smooth); </ins> } }

return undefined; } <del> protected override revealLine(lineNumber: number) { </del> <ins> protected override revealRange() { </ins> // we don't do anything here as we always do the reveal ourselves. }

import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { Position } from 'vs/editor/common/core/position'; <ins> import { Range } from 'vs/editor/common/core/range'; </ins> import { rot } from 'vs/base/common/numbers'; import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { EmbeddedDiffEditorWidget } from 'vs/editor/browser/widget/embeddedCodeEditorWidget';

}); } <del> protected override revealLine(lineNumber: number) { this.editor.revealLineInCenterIfOutsideViewport(lineNumber, ScrollType.Smooth); </del> <ins> protected override revealRange(range: Range) { this.editor.revealLineInCenterIfOutsideViewport(range.endLineNumber, ScrollType.Smooth); </ins> } hasFocus(): boolean {