{"id":242918,"date":"2023-05-18T08:00:12","date_gmt":"2023-05-18T15:00:12","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/visualstudio\/?p=242918"},"modified":"2023-05-18T15:31:45","modified_gmt":"2023-05-18T22:31:45","slug":"sticky-scroll-stay-in-the-right-context","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/sticky-scroll-stay-in-the-right-context\/","title":{"rendered":"Sticky Scroll: Stay in the Right Context"},"content":{"rendered":"<p>When coding in a long file, it\u2019s easy to lose track of the method or block you\u2019re writing in. Or when scrolling through an unfamiliar codebase, it can become disorienting where you are in the code.<\/p>\n<p>Sticky Scroll can help you stay in the right context by sticking helpful scopes, including namespaces, classes, methods, loop initialization statements, and conditionals. Multiple code formats are supported, including C#, C++, XAML, and JSON. With a single click on a line in the Sticky Scroll header, you can quickly navigate directly to that line of code. Learn more about it <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/sticky-scroll-now-in-preview\/\">from the previous blogpost<\/a>.<\/p>\n<p>We <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/sticky-scroll-now-in-preview\/\">first released Sticky Scroll in 17.5 Preview 2<\/a> and it\u2019s now moving into the latest 17.6 release! Since our last update, we\u2019ve added a new option to stick inner scopes so you can easily track the scopes that are closer to what you\u2019re working on.<\/p>\n<p><div  class=\"d-flex justify-content-center\"><a class=\"cta_button_link btn-primary mb-24\" href=\"https:\/\/visualstudio.microsoft.com\/vs\/\" target=\"_blank\">Download Visual Studio 2022<\/a><\/div><\/p>\n<p>Let us know what you think of Sticky Scroll in Visual Studio on <a href=\"https:\/\/developercommunity.visualstudio.com\/t\/Sticky-function-signatures-when-scrollin\/10117341\">this feedback ticket.<\/a><\/p>\n<h2>New: Choose between outer or inner scopes<\/h2>\n<p>We\u2019ve heard feedback about how sticking outer scopes isn\u2019t helpful. Oftentimes, the namespace and class name match the file name. It can feel wasteful to give up two lines of vertical space for info that is often obvious. Instead, it\u2019d be more useful if lines that are likely to be different are shown instead.<\/p>\n<p>In Options, you can configure whether outer or inner scopes are prioritized with &#8220;When number of scopes exceeds the maximum&#8221;.<\/p>\n<p>\u201cPrefer outer scopes\u201d is set by default, which shows the higher-level scopes that come from the top of the file. The new option \u201cPrefer inner scopes\u201d shows lower-level scopes by pushing out higher-level scopes as you scroll through deeply nested code.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/05\/sticky-scroll-scopes.png\"><img decoding=\"async\" class=\"aligncenter wp-image-242921 size-full\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/05\/sticky-scroll-scopes.png\" alt=\"Tools &gt; Options &gt; General &gt; Sticky scroll &gt; \u201cWhen number of scopes exceeds the maximum:\u201d\" width=\"936\" height=\"648\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/05\/sticky-scroll-scopes.png 936w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/05\/sticky-scroll-scopes-300x208.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/05\/sticky-scroll-scopes-768x532.png 768w\" sizes=\"(max-width: 936px) 100vw, 936px\" \/><\/a><\/p>\n<p>\u201cPrefer outer scopes\u201d shows top-level scopes:<a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/05\/sticky-scroll-outer-scopes.gif\"><img decoding=\"async\" class=\"aligncenter wp-image-242920 size-full\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/05\/sticky-scroll-outer-scopes.gif\" alt=\"Outer scopes stick in the header\" width=\"1493\" height=\"373\" \/><\/a><\/p>\n<p>\u201cPrefer inner scopes\u201d shows lower-level scopes:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/05\/sticky-scroll-inner-scopes.gif\"><img decoding=\"async\" class=\"aligncenter wp-image-242919 size-full\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/05\/sticky-scroll-inner-scopes.gif\" alt=\"Inner scopes push out outer scopes.\" width=\"1500\" height=\"375\" \/><\/a><\/p>\n<h2>Try Sticky Scroll in Visual Studio 2022 17.6<\/h2>\n<p>Enable it in<em>\u00a0Tools &gt; Options &gt; Text Editor &gt; General &gt; Sticky Scroll<\/em>\u00a0by toggling the checkbox for \u201cGroup the current scopes within a scrollable region of the editor window.\u201d But if you need to quickly turn it off, you can right-click on the Sticky Scroll area and click \u201cSticky Scroll\u201d.<\/p>\n<h2>Please Share Your Feedback<\/h2>\n<p>Let us know what you think of Sticky Scroll in Visual Studio on <a href=\"https:\/\/developercommunity.visualstudio.com\/t\/Sticky-function-signatures-when-scrollin\/10117341\">this feedback ticket<\/a> and <a href=\"https:\/\/developercommunity.visualstudio.com\/VisualStudio\/report\">report any issues<\/a> you face so we can improve the experience.<\/p>\n<p>&nbsp;<\/p>\n<p><em>Update:\u00a0<\/em><\/p>\n<p>Sticky Scroll requires Block Structure Guides to be enabled for some languages (e.g., C#). If Sticky Scroll is not working, try enabling the following options in Tools &gt; Options &gt; Text Editor &gt; C# &gt; Advanced.<\/p>\n<table style=\"border-collapse: collapse; width: 100%;\">\n<tbody>\n<tr>\n<td style=\"width: 50%;\"><strong>Option<\/strong><\/td>\n<td style=\"width: 50%;\"><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">Show guides for declaration level constructs<\/td>\n<td style=\"width: 50%;\">Affects namespaces, classes, method initializations<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">Show guides for code level constructs<\/td>\n<td style=\"height: 28px; width: 50%;\">Affects conditionals, loops<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>When coding in a long file, it\u2019s easy to lose track of the method or block you\u2019re writing in. Or when scrolling through an unfamiliar codebase, it can become disorienting where you are in the code. Sticky Scroll can help you stay in the right context by sticking helpful scopes, including namespaces, classes, methods, loop [&hellip;]<\/p>\n","protected":false},"author":105708,"featured_media":255385,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[155],"tags":[6879,526],"class_list":["post-242918","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-studio","tag-editor","tag-productivity"],"acf":[],"blog_post_summary":"<p>When coding in a long file, it\u2019s easy to lose track of the method or block you\u2019re writing in. Or when scrolling through an unfamiliar codebase, it can become disorienting where you are in the code. Sticky Scroll can help you stay in the right context by sticking helpful scopes, including namespaces, classes, methods, loop [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/242918","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/105708"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=242918"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/242918\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/255385"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=242918"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=242918"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=242918"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}