Visual Studio 2013 Preview: Enhanced Scroll Bar
Visual Studio 2013 has another great new feature: enhanced scroll bar functionality. The new scroll bar will show cursor location, breakpoints, and much more! Let’s take a look.
Before we begin I want to address where some of the new features in VS2013 are coming from. In Visual Studio 2013 many of the new features we put into the product were actually introduced via the Productivity Power Tools for Visual Studio 2012. This is an ongoing trend and you will see that many of the new features from future versions will come directly from the Power Tools. If you are still on 2012 you can get a lot of the newest functionality by installing the Visual Studio 2012 Power Tools which can be found here:
Scroll Bar Options
To really get a handle on the new scroll bar functionality the first thing you should do is Right Click on the vertical scroll bar and choose Scroll Bar Options:
You will see several settings that can be modified:
(NOTE: You can also get to this area by going to Tools | Options | Text Editor | All Languages | Scroll Bars)
Show Scroll Bar
The first two options are pretty self-explanatory they will allow you to show or hide the scroll bars. For the most part you will leave these checked unless you have some special reason not to have them visible.
The Display area allows you to turn on annotations that will show special items throughout the entire document within the scroll bar. This allows you, at a glance, to see where things like breakpoints and bookmarks are. We will look at these in the order you are most likely to encounter them but here is an example of the vertical scroll bar with annotations in it:
Show Caret Position
The first annotation you will most likely encounter is the caret position indicator. It simply shows the current position of the cursor with a blue line in the scroll bar.
If you missed my blog post a couple of years ago on tracking changes in the editor, this is a good time to read it. You can find the post here:
The Show Changes option simply shows the changes within it so you can see modifications at a glance for the entire document.
This options is fairly broad and covers several types of marks that can appear in code. Most notably this will show breakpoints:
Additionally, this will also show things like Bookmarks:
The final indicator is arguably one of the most important. It shows any syntax errors the editor is aware of:
This let’s you quickly see where there are errors that need to be fixed before you compile your code.
There are two behavior options for the vertical scroll bar: bar mode and map mode. So far everything we have seen is the traditional bar mode for the scroll bar. Now we will switch to map mode:
Map mode essentially turns your vertical scroll bar from this:
Map mode is miniature look at your document so you can quickly get a feel for your code. There are four options for source overview when using map mode. I’ll show examples of the four views below. Of these the Off setting will be the most confusing until you see the Preview Tooltip in action so be patient.
Regardless of which map mode view you use there is also an option to have the Preview Tooltip. Simply put your mouse pointer over any part of the vertical scroll bar and you will get a preview of the code at that position in the document:
All annotations previously mentioned also show up in map mode:
Go to a Specific Location on the Scroll Bar
You basically have two options when you want to go to a specific location on the scroll bar. Let’s examine both ways.
As long as you are in map mode:
You can simply LEFT CLICK any area on the scroll bar and you will jump to that location:
For this reason, I suggest, even if you don’t want the map, that you at least use map mode set to Off to get this functionality so you can quickly move around using the scroll bar:
Now that you have a solid base level of knowledge for this feature there is one more important item I want to show you: Scroll Here. If you find any place that is interesting to you in the vertical scroll bar and want to quickly go to that location you can simply Right Click the location and choose Scroll Here:
The new location will come into view so you can begin looking at the code:
The enhanced vertical scroll bar is a great tool for developers to quickly see places of interest and to examine those locations. Try this feature out and see if you like it as much as I do. :)