Sticky scroll in vscode
Enable VS Code's powerful Sticky Scroll feature! Keep contextual lines (like class, function, or section headings) pinned to the top of your editor for effortless code and document navigation.
This article is over a year old but was reviewed on July 30, 2026 — the content is still accurate.
This article is part of the VSCode - Tips, extensions and shortcuts series:
- Markdown folding not working
- Start vscode from github.com
- Sticky scroll in vscode
- Autosave feature in VSCode
- Error Lens addon for VSCode
- CodeSnap addon for VSCode
- Export the list of extensions you've installed in VSCode
- Multiple cursors in vscode
- PHP Getter and Setter in VSCode
- Working with regions in VSCode
- Using the JetBrains Mono font in vscode
- Todo Tree in VSCode
- Do I need VSCode on my machine to use it?

This article shows VSCode's Sticky Scroll feature, which pins contextual lines (class name, function name, current heading level in Markdown, etc.) to the top of the editor as you scroll, so you always know where you are in the file. It's enabled by adding "editor.stickyScroll.enabled": true to settings.json.
VS Code has recently added a really useful new feature: sticky scroll.
This function allows you to scroll through a document such as a Markdown file, source code written in PHP or JavaScript, or any other supported language and, as you scroll, pin contextual information such as the name of the class, the name of the function, the start of the loop, etc. in the upper part of the editor.
It pairs nicely with code folding: Working with regions in VSCode lets you collapse whole blocks, sticky scroll keeps you oriented in the ones you left open.
This is really very practical. See the illustration below (image coming from https://dev.to/amrsamy/vs-code-sticky-scroll-2jcd)

Below is an example taken from this blog:

As you can see, I have opened a Markdown file and I am showing part of the article around line 878. Pay attention to the first 'stuck' lines in the window: VS Code is showing me my heading 1, my heading 2 and my heading 3 so I know the context. The displayed lines are located in the chapter Make it easy. That's pretty cool!
To enable the feature, edit your settings.json file and add this entry:
"editor.stickyScroll.enabled": true
This is a configuration setting that enables sticky scroll in a code editor, which keeps the top lines of your current code block visible at the top of the editor window as you scroll down through the file.
Sticky scroll helps you know where you are in a long file. The other half of the problem is hiding what you don't need right now, and that's what Working with regions in VSCode is about.
This article is part of the VSCode - Tips, extensions and shortcuts series:
- Markdown folding not working
- Start vscode from github.com
- Sticky scroll in vscode
- Autosave feature in VSCode
- Error Lens addon for VSCode
- CodeSnap addon for VSCode
- Export the list of extensions you've installed in VSCode
- Multiple cursors in vscode
- PHP Getter and Setter in VSCode
- Working with regions in VSCode
- Using the JetBrains Mono font in vscode
- Todo Tree in VSCode
- Do I need VSCode on my machine to use it?





