简体   繁体   中英

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

In the VSCode editor when you pull the scroll bar down to the bottom of the file, all you see is a blank page , since the text has scrolled up past the top of the text editor window. This makes scrolling to the bottom difficult because you can't just pull the scroll bar quickly all the way down but have to carefully position the cursor so you can still see your code.

Very similar to How to make Visual Studio editor stop scrolling past bottom of a file? , but comments have pointed out that question/answer is for Visual Studio. This answer is for VSCode on the MacOS.

The correct answer is seen here: https://stackoverflow.com/a/40588828/1189470

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 -> Preferences 中标记为“Editor: Scroll Beyond Last Line”。

If just for readability you would like some space at the bottom of the file - a configurable amount - try this setting as of v1.43:

editor.padding.bottom in pixels

Editor> Padding: Bottom

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

and/or

editor.padding.top // but this isn't sticky in the sense that you can scroll right past the padding top and it is gone. It doesn't stay.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM