Compartilhar via


Visual Studio Tips and Tricks: Enhanced Scroll Bar

Preview and identify code faster with the enhanced scroll bar feature added in Visual Studio 2013

Find more Visual Studio tips and tricks here

Fans of Sublime will be happy to see new feature in Visual Studio 2013. The enhanced scroll bar highlights and previews code in your file. This post will cover

  • Highlighting code with the enhanced scroll bar
  • Previewing code with the enhanced scroll bar
  • How to get Visual Studio 2013

Highlighting code with the enhanced scroll bar

Take a look at the following screenshot from Visual Studio 2013, notice the different color indicators in the scroll bar. These indicators highlight different points of significance in my code.

Visual Studio 2013 Enhanced Scrollbar

When you make changes to your code, the scrollbar highlights the locations of your modified code using yellow

image

Locations of breakpoints are highlighted with purple.

image

Locations of compilation errors are highlighted with red

image

The current cursor location is highlighted with a bar.

image

Previewing code with the enhanced scroll bar

By default when you install Visual Studio 2013, the scroll bar is in bar mode. If you want to preview code with the scroll bar you must change it to map mode. To change the scroll bar mode, right click on the scroll bar itself and choose Scroll Bar Options from the context menu. You could also locate the scroll bar settings by typing “scroll bar” in the Quick Launch, or by navigating to Tools | Options | Text Editor | All Languages | Scroll Bars from the menu.

To see a preview of code using the scroll bar change the behavior from “Use bar mode for vertical scroll bar” to “Use map mode for vertical scroll bar”

image

In map mode, the scrollbar shows thumbnails of the code, and if you hover over the a portion of the scrollbar, you see a preview of the code at that location.image

You can control the width of the scrollbar in map mode by changing the Source Overview in the scroll bar settings. Turning off the Show Preview Tooltip setting would turn off the code preview that appears when you hover over the scrollbar.

image

Yet another reason to upgrade to Visual Studio 2013!

Where can I get Visual Studio 2013?

The enhanced scroll bar is a new feature in Visual Studio 2013. So if you haven't downloaded a copy yet. You can download it and start exploring today.

Comments

  • Anonymous
    January 22, 2014
    This extension led to slow down of my visual studio,may be it is a bit cpu hungary

  • Anonymous
    January 22, 2014
    Hi Rohit, Odd, it's not an extension, it's built into Visual Studio 2013. You just have to choose to display in map mode if you want the code preview. I am running it on a laptop that is not designed to be a developer laptop and haven't had any issues.  But I'll watch out for that, and see if I hear from anyone else who has that problem.

  • Anonymous
    January 22, 2014
    Thanks - I was wondering why the elevator shaft (scrollbar) in VS 2013 had become Glooperized and gotten the measles!

  • Anonymous
    January 22, 2014
    It wasn't just for decoration :)

  • Anonymous
    August 26, 2014
    And what about green?

  • Anonymous
    August 26, 2014
    Hmmm, I have never seen green on my scrollbar. But if you go to the Scrollbar settings (as described in the post) you will notice you can turn on and off the different annotation settings. So I am going to suggest the when all else fails programmer tactic: deselect the features (Show Changes, Show Marks, Show errors, Show Caret position) one by one and see which one makes the green indicator disappear.

  • Anonymous
    May 18, 2015
    Green means unused variable.

  • Anonymous
    September 21, 2015
    The comment has been removed

  • Anonymous
    September 21, 2015
    okay, here it is: i1.visualstudiogallery.msdn.s-msft.com/dbcb8670-889e-4a54-a226-a48a15e4cace

  • Anonymous
    September 22, 2015
    Falco - yeah I usually install the Productivity power tools they have some nice extra features!