VS Code Sticky Scroll


VS Code version 1.70 added the feature "sticky scroll".


settings.json:


{
    "editor.stickyScroll.enabled": true
}


This allows the declaration for a code block to stay in view while scrolling vertically: similar to frozen rows in Excel.


An animated demonstration appears in the announcement.



Sticky Scroll in Trees


VS Code version 1.85 added the preview feature "Sticky Scroll in Trees".


settings.json:


{
    "workbench.tree.enableStickyScroll": true
    "workbench.tree.stickyScrollMaxItemCount": 7
}


This takes the sticky scroll behavior from the editor window and applies it to tree views like a folder tree in the Explorer panel.



Terminal Sticky Scroll


VS Code version 1.85 also added sticky scroll for the terminal.


Sticky scroll for the terminal requires the VS Code shell integration. See the "Terminal" section in the v1.85 update notes.


settings.json:


{
    "terminal.integrated.stickyScroll.enabled": true
}


In the terminal, sticky scroll shows the last command while you scroll through output.


Further down, the patch notes read:


[Shell integration] will also trim empty lines from the top of the prompt, commonly used to split up output and make the terminal easier to read.


This makes sense. If you have a custom prompt, you don't have to change it. And, inside VS Code, the shell integration will detect blank lines at the top of the terminal and replace them with the sticky scroll visual. If it didn't do this, you would have two or three blank lines pinned to the top of the terminal and wasting space.



References


Sticky Scroll Announcement

Sticky Scroll | Released Feature

Visual Studio Code v1.85

FYI: Freeze columns or rows in Microsoft Excel | YouTube


Created: Monday, August 15, 2022

Updated: Tuesday, December 19, 2023




/gemlog/