Thursday, April 25, 2024
HomeJavaScriptNew in VS Code – Sticky Scroll

New in VS Code – Sticky Scroll


The VS Code 1.70 launch notes share a brand new nifty experimental editor function – sticky scroll!

Discover and allow “Sticky Scroll” in your VS Code settings.

VS Code settings showing the Sticky Scroll option.

Or add the next line to your settings.json:

{
  "editor.experimental.stickyScroll.enabled": true
}

And now, see your JavaScript operate signatures stick on the highest.

Scrolling in VS Code displaying that operate signatures stick on the high.

You would possibly argue now that for JavaScript it is an pointless editor function as a result of if you happen to write clear code with quick features, you will not want it. However a) I am all the time completely happy about fairly editor UI options and b) it really works for different file codecs equivalent to json, css or yaml, too.

VS Code showing a nested JSON files in which the surrounded property lines are sticky.

After sharing this function on Twitter, Elio Struyf identified which you could additionally configure the sticky aspect’s background colour. 🎉

{
  "workbench.colorCustomizations": {
    "editorStickyScroll.background": "#D44",
    "editorStickyScrollHover.background": "#A00"
  }
}

It’d want a little bit tweaking to make it work together with your colour theme, although. 🙈

VS Code with coloured sticky operate signatures.

Additionally, if you wish to restrict the variety of sticky traces use editor.stickyScroll.maxLineCount. The setting’s 5 by default.



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments