Change:
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> } }

Discussion:
<!-- 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