When working in code with long classes and methods that stretch beyond the vertical size of your screen, it can be difficult to keep track of which scope you’re working in. You may be editing a long method or exploring an unfamiliar codebase.
In Visual Studio 2022 17.5 Preview 2, we introduced Sticky Scroll to help you be more productive and save time when going through your codebase. Sticky Scroll provides immediate context to the code in which you’re working by keeping the relevant headers in your view. To start using Sticky Scroll today, update to the latest version of Visual Studio Preview and enable it in Tools > Options > Text Editor > General > Sticky Scroll by toggling the checkbox for “Show the nested current scopes during the scroll at the top of the editor”.
Download Visual Studio PreviewStay Oriented in Your Code as You ScrollAs you scroll through your code, namespaces, classes, and methods will stick to the top of the editor! Sticky Scroll supports multiple code formats, including C#, C++, XAML, and JSON.
C# exampleC++ exampleSingle Click NavigationIn addition to sticking to the top of the editor, the headers also take you straight to that line of code. Clicking on one of these lines will quickly navigate you to the top of that indentation level.
Try It Out in Visual Studio 2022 17.5 Preview 2Enable it in Tools > Options > Text Editor > General > Sticky Scroll by toggling the checkbox for “Show the nested current scopes during the scroll at the top of the editor”. You can also set the maximum number of sticky lines with the “Define the maximum number of sticky lines to show” option.
Please Share Your FeedbackWe hope this feature will help you be more productive with your coding. As we continue to work on this feature, we appreciate your feedback. Let us know what you think of Sticky Scroll in Visual Studio on this feedback ticket and report any issues you face so we can improve the experience.
The post Sticky Scroll now in preview appeared first on Visual Studio Blog.