dmorrow
dmorrow

Reputation: 5664

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 and Windows.

Upvotes: 127

Views: 22048

Answers (3)

Mark
Mark

Reputation: 180611

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.

Upvotes: 25

joe
joe

Reputation: 729

This is now exposed as a simple checkbox labeled "Editor: Scroll Beyond Last Line" in File/Apple -> Preferences.

Upvotes: 49

dmorrow
dmorrow

Reputation: 5664

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.

Upvotes: 199

Related Questions