Visual Studio 2013 New IDE Features

Disclaimer : A reader over at Reddit commented that I didn’t mention which edition of Visual Studio I was basing this article on as some of the features are not available on certain editions of the tools. This article is based on Visual Studio 2013 Ultimate Edition which I use via my companies MSDN subscription.

Now that Visual Studio 2013 has been released and I have had a little play around with it, I thought I would write about some of my favorite new IDE features. Microsoft has added in some useful features that will really make using the IDE a richer experience.

As a larger package Microsoft has packed a lot into Visual Studio 2013. For a more complete look at the new features in this development environment you can view the official release notes at MSDN.

Visual Studio 2013 Integrated Development Environment

Visual Studio 2013 Integrated Development Environment

The new IDE features I want to cover are:

    • Code Preview Scroll Bar
    • Peek Definition
    • Code Lenses
    • Test Explorer – Sort by Class
    • Sign in to Visual Studio

Code Preview Scroll Bar

When you are working with large code bases, it can be hard to keep everything in mind as you navigate through the files. You can customize the scroll bar of the code window to give you a bird’s eye view of what’s happening in your code. To enable this code preview is easy. You need to:

    1. Right click on the scroll bar in the code view and select “Scroll Bar Options”;
    2. In the dialog box, check the “Show Preview Tooltip” checkbox.
    3. Click the ‘OK’ Button.

Turn on Preview Toolbar in Visual Studio 2013

Turn on Preview Toolbar in Visual Studio 2013

Once you have done this you will see a preview of the code where the scroll bar used to be. At first I was a little skeptical about the value of this, but after using it for a while, I really like it. As you move the mouse pointer over the code in the preview window you get a small window over your code so you can read where you are scrolling too.

Visual Studio 2013 Code Preview Scroll Bar

Visual Studio 2013 Code Preview Scroll Bar

Another nice feature with this preview window is the change markers. When you make edits to the code file you will see a Yellow marker appear showing you where the edits have occurred on the preview window. If you make any edits that break the code you will see a Red marker. In the example below you can see I have made 3 edits to the code file, of which 2 of the edits will cause a code compilation error.

Visual Studio 2013 Preview Scroll Bar Change Markers

Visual Studio 2013 Preview Scroll Bar Change Markers

These code markers will also show Breakpoints and Bookmarks. You can also see a solid horizontal Blue line in the code preview window; this shows the current editor cursor position so you can see where about in the overall file you are editing. The Black box outline indicates how much of the code in the preview is currently being shown to the developer in the code view.

Peek Definition

Previously in Visual Studio, if you want to browse to the definition of a class/object you put the cursor over that object name and hit F12. This would open up another code window and browse you to that object. This has always been very useful, but it does shift your focus away from the code you are working on. Generally you wanted to browse to the definition to refer to the code. Now Visual Studio 2013 gives you an additional option. If you don’t want to break your concentration away from the code you are working on, but just want to refer to an objects definition, you place the cursor over the object but this time press ‘ALT+F12’. This new feature is called Peek Definition.

Visual Studio 2013 Peek Definition

Visual Studio 2013 Peek Definition

This keyboard shortcut will open up an inline window showing the code you wanted to navigate too. This is very useful as it means you don’t have to interrupt your concentration from your original coding task. If you use the ‘ALT+F12’ shortcut multiple times then the same inline window is used, but you have a set of breadcrumbs that allows you to navigate between the opened files, as well as a code file tab, see below.

Visual Studio 2013 Nested Code in Peek Definition

Visual Studio 2013 Nested Code in Peek Definition

What is also great is that if you have the Code Preview scroll bar turned on, you will also get the new scroll bar displayed in the inline code window. The thick grey line at the top of the inline code window, acts as a re-size handle, so you can adjust the size of the window to suit your screen size.

Code Lenses

Code Lenses let you find items related to your code without leaving the editor when you use the Code Lens heads-up display. For example, you can find references, linked Team Foundation Server (TFS) items, and unit tests – all in the same context as your code.

In the example below you can see 2 lenses above the EncryptCard method. The first lens show you that there are 18 references to this method, and the 2nd lens tells you there are 14 unit tests for this method, and all 14 of those tests are passing.

Visual Studio 2013 Unit Test Coverage Code Lens

Visual Studio 2013 Unit Test Coverage Code Lens

In the screen shot above, if you click on the ‘14/14 Passing’ Lens you will see a small balloon popup appear. From here you will see a list of the tests covering that method. You can double click on any of the tests to go to the actual test code, or you can run that subset of tests directly from the balloon popup. There is also a ‘Dock Popup’ button that will move this information into a docked window (as shown in the screen shot as the screen snipper tool I am using wouldn’t let me get a screen grab with the balloon window open).

Visual Studio 2013 Code References Code Lens

Visual Studio 2013 Code References Code Lens

The screenshot above shows the options you get if you click on the references lens. This is very useful to see at a glance what code is calling the object you are working on. There is also a button to show the code the lens is associated with on the code map. This is great if you are working on a code base that you are not totally familiar with, which is a grim reality in the brownfield development environment of legacy enterprise software.

Visual Studio 2013 Code Map from a Code Lens

Visual Studio 2013 Code Map from a Code Lens

Code maps can get fairly complex and use a lot of screen real-estate. The code map view in the screen shot above works OK as I am viewing on a decent sized 24” screen, but a lot of the time you will need to dock the code map into a window on top of the code, or move it out to a 2nd monitor. The user experience of Visual Studio is really transformed when you use it on a 2nd screen.

Visual Studio 2013 Code Lens for TFS Integration

Visual Studio 2013 Code Lens for TFS Integration

Visual Studio also provides a set of Code Lenses if your project is connected to a TFS repository. This lets you view changes, bugs and work items associated with the code you are working on. These TFS Code Lenses really enrich the user experience when working with TFS.

Test Explorer – Sort by Class

Since the last couple of service packs for Visual Studio 2012, the new Test Explorer view has got much better, but the feature I really missed was a group by class option. Thankfully, Microsoft have now added it, so instead of just group by duration, outcome, traits and project, you can now view tests grouped by the class that they belong too.

Visual Studio 2013 Group Tests by Class in Test Explorer

Visual Studio 2013 Group Tests by Class in Test Explorer

To change the grouping to group by class, just right click in the Test Explorer window and select ‘Class’ from the ‘Group By’ sub menu.

Sign in to Visual Studio

The final feature I want to mention is the new Sign in to Visual Studio using a Microsoft account. This helps personalize and optimize your Visual Studio development experience. The new connected IDE uses your Microsoft account to connect to your Visual Studio profile, including any team accounts for Team Foundation Services. The first time that you start Visual Studio, you supply the credentials for your Microsoft account. Based on that authentication, Visual Studio finds and applies your license and synchronizes your settings (such as fonts, language preference, and keyboard settings) across all of your computers.

Sign in to Visual Studio with a Microsoft Account

Sign in to Visual Studio with a Microsoft Account


Conclusion

The move from Visual Studio 2010 to 2012 was a radical step between the two versions. The new user interface really seemed to divide opinion. Personally I loved the new direction. The change from Visual Studio 2012 to 2013 isn’t as radical, but the new IDE features they have added really make for an improved user experience. I have been working with the new IDE for just over a week now, and I am already using these features constantly.

For some people these types of features may not be that new when you have used the Visual Studio Power Tools, Resharper, or Code Rush, but using those tools compliments what is now available in Visual Studio. Microsoft has now provided the old and much loved ‘Blue’ theme out of the box and they have also added a subtle splash of color over the IDE. Whilst these are subtle, I feel they add to the user experience, as you will be staring at these screen for hours on end. Overall I am very impressed with this update and I look forward to seeing what Microsoft does next.

Participate with Coding in the Trenches on Facebook

Participate with Coding in the Trenches on Facebook by Click the button above.

This entry was posted in Tools, Visual Studio and tagged , . Bookmark the permalink.

One Response to Visual Studio 2013 New IDE Features

  1. Pingback: Top 10 Tools That Have Changed the Way I Work | Stephen Haunts { Coding in the Trenches }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s