如何让 VSCode 编辑器停止滚动到文件底部?

How to make VSCode editor stop scrolling past bottom of a file?

在VSCodeeditor中拉滚动条到文件底部时,你看到的都是是一个 空白页 ,因为文本已经向上滚动超过了文本编辑器 window 的 top。这使得滚动到底部变得困难,因为您不能将滚动条快速拉到底,而是必须小心定位光标,这样您仍然可以看到您的代码。

How to make Visual Studio editor stop scrolling past bottom of a file?非常相似,但评论指出question/answer是针对Visual Studio的。此答案适用于 macOS 上的 VSCode 和 Windows.

正确答案见此处:

There is a configuration option provided in VSCode for the functionality you specified. To enable it, go to File -> Preferences -> user settings

On the right side of the editor in settings.json paste the below line at the bottom (before closing bracket), save and close.

"editor.scrollBeyondLastLine": false

This will prevent the editor from scrolling beyond the last line.

这现在在 File/Apple -> 首选项中显示为标记为 "Editor: Scroll Beyond Last Line" 的简单复选框。

如果只是为了便于阅读,您希望在文件底部添加一些 space - 可配置的数量 - 从 v1.43 开始尝试此设置:

editor.padding.bottom 像素

Editor> Padding: Bottom

Controls the amount of space between the bottom edge of the editor and the last line.

and/or

editor.padding.top // 但这不是 sticky,因为您可以向右滚动到填充顶部并且它消失了。它不会留下来。