Sticky scrolling in VS Code

Amit Merchant · August 23, 2022 ·

Love it or hate it but VS Code by Microsoft is one of the most widely used text editors today and that’s because of its versatility and features that are helpful.

So, in a recent version, the editor comes packed with an experimental feature that can make writing/reading code a joyful experience.

The feature is essentially a sticky scrolling that lets you know in which scope (class/interface/namespace and function/method/constructor) you’re currently scrolling.

You can enable this feature by setting "editor.experimental.stickyScroll.enabled" to true in your VS Code’s settings.json or search for “sticky scroll” in the Setting’s search and tick the checkbox for the appeared setting.

Here’s what scrolling through the code looks like when the feature is enabled.

Sticky scrolling in VS Code

As you can tell, when you scroll, the current function/method/class definition gets “stuck” to the top which effectively lets you know in which scope you’re currently in. And this, in my opinion, is a game changer and can drastically improve the way you read/write your code!

👋 Hi there! I'm Amit. I write articles about all things web development. If you like what I write and want me to continue doing the same, I would like you buy me some coffees. I'd highly appreciate that. Cheers!