First Look at the New C++ IDE Productivity Features in Visual Studio 11

First Look at the New C++ IDE Productivity Features in Visual Studio 11

  • Comments 53

Sumit Kumar

Hi! I am Sumit Kumar, a Program Manager on the Visual C++ team.

Today I will talk to you about some of the exciting new IDE functionality in the next version of Visual Studio that will make you, the C++ developer, more productive with your daily code focused tasks. In this blog post you will get a preview of the new features that help with code understanding and editing. There will be more blog posts talking about other cool new features.

 

 

Code Understanding enhancements

Semantic Colorization

Semantic Colorization helps you quickly scan the code and infer more semantic meaning through enhanced visual feedback in the editor. In addition to the keywords, strings and comments, now other tokens like types, enumerations and macros are colorized; the parameters are in italics and so on. The screenshot below shows an example. Notice how the macros, types, function parameters etc. pop out and make understanding code so much easier.

Semantic colorization

While there are only a few tokens that are colorized differently by default, around twenty different semantic tokens are exposed to the users as shown in the screenshot below.

Fonts and colors

You can customize your IDE to colorize these tokens differently. For example, you could choose to colorize local and global variables differently which could be a handy source understanding aid when the variables are identically named but defined in different scopes.

 

Reference Highlighting

Another great productivity feature that aids you in understanding code is Reference Highlighting. When you place your text cursor on a symbol, all the instances of that symbol in the file get highlighted. Only the true references are highlighted – for example, two symbols with same names in different scopes (say local vs. global) will not be highlighted at the same time. You can use Ctrl+Shift+Up and Ctrl+Shift+Down keys to move between the highlighted references. This means that you no longer have to invoke Find All References if you are simply looking for symbols within a file. The screenshot below shows how all the instances of the variable cxExtentMax inside the function body are highlighted when the cursor is placed on the one referenced in the call to max(). But the variable with same name defined outside the function scope is not highlighted.

Reference highlighting

 

New Solution Explorer

There are a number of tool windows needed for common everyday tasks – for example, Navigate To is used for searching symbols and files, Class View and Object Browser are used for inspecting the members of an object, Find All References is used for, well, finding references, Call Hierarchy is used for finding the calls to and from a function etc. Imagine being able to do all of these operations from a single tool window without having to switch context or sacrifice additional precious screen real-estate. The new Solution Explorer combines most of the functionality of these tool windows into one place, itself! Of course, the other tool windows will still be available in Visual Studio, but the goal of the new Solution Explorer is to significantly reduce the need to invoke them for the most common scenarios. A detailed description of all of the new functionality provided by the versatile new Solution Explorer is a separate blog topic in itself, but here is a sampling:

You can expand your files to see the fields, functions and types contained in the files and the members contained in the types.

New Solution Explorer

It allows you to search your entire solution all the way to the members of individual classes.

New Solution Explorer

You can navigate back and forward between different views of the Solution Explorer and can create multiple instances of Solution Explorer rooted at different nodes if needed. You can also scope the view to just a specific project or file or type.

New Solution Explorer

The view in editor automatically syncs with the view in Solution Explorer. Clicking on a symbol node in the Solution Explorer takes you to the definition of that symbol in the editor. You can also see the relationship between functions such as Calls to, Calls from, References, and Inheritance for functions and types from within the Solution Explorer.

New Solution Explorer

New Solution Explorer

 

 

Code Editing enhancements

The second category of C++ features helps you with editing code faster.

Automatic Display of IntelliSense Member List

In Visual Studio 2010 and previous releases, the IntelliSense member list dropdown had to be explicitly invoked either by typing Ctrl+Space or Ctrl+J or entering a scope resolution operator (::) or element selection operator (. or ->). In the next version, Visual Studio will automatically shows the member list drop down as you type without the need to explicitly invoke it.

Automatic Display of IntelliSense Member List

The automatic display of member list is smart – it does not aggressively display the member list when it does not make sense, for example when typing a declaration, there is no aggressive display of member list.

Automatic Display of IntelliSense Member List

 

Member List Filtering

Not only is the member list displayed automatically, it is also filtered as you type to shrink and show only the relevant members. So you can get a filtered result like the screenshot below just by typing two characters

Member List Filtering     Member List Filtering

Notice that pb is not a prefix or even a substring of the members in the list. The filtering uses a fuzzy logic to find the relevant members quickly. But if you do not like the fuzzy filtering, you can change it to prefix based, or prefix plus camel casing based or turn off the filtering completely.

 

Code Snippets

Code Snippets help you quickly type the boilerplate code with just a couple of keystrokes. Here’s how it works for a switch statement: as you start typing, the IntelliSense member list shows you the relevant code snippet that can be selected by pressing tab.

Code Snippets

Code Snippets

Then modify the expression in the switch statement or just press Enter and the entire skeleton of the switch statement is added for you; you only need to fill in the logic!

Code Snippets

In addition to the switch statement, there are other snippets for basic code constructs available to you – like if-else, for loop, etc. Each of the snippets saves you from unnecessary typing and lets you focus more on your logic, adding up to significant productivity gains over time!

Additionally, the code snippets feature is extensible so you can also create your own snippets, which is as simple as creating a simple XML file and copying it at a certain location. You can also invoke the code snippets from the context menu in the editor and can either insert a snippet or can surround a selection of code with a code snippet (for example with a #ifdef statement).

 

 

Summary

Many of these code understanding and editing features were requested by you, and are squarely intended to make you more productive with C++ development. Your continued feedback will help us make these features better before they ship. Please note that the descriptions and screenshots are from our early internal builds. These features are still under development and could potentially change or not even be included in our final product. In addition to these new features, we have done a lot of work on the IDE but I will save those for future blog posts.

 

[Keep learning about new features for C++ developers in Visual Studio 11]

  • These features look interesting, and I hope they don't add decreased performance and extra overhead to the  (unsinkable) Titanic of IDEs.  Out of all of them, I think Semantic Colorization might be the most useful, because anything that helps usability nearly 100% of the time is good!  I mean: developers typically spend a lot of time reading and writing code - so, this "feature" might be used significantly to help developers more quickly parse the semantics/understanding of code.  Thanks again for your post + knowledge sharing !/!

    To risk stating the obvious, I feel a strong vibe on this blog about Performance.  Will there be any performance posts, that focus on performance improvements in VS. Next?  On very small projects I *mostly* prefer VS2010 over VS2005 (which I upgraded from), but really on anything > tiny, 10 is NOT the new 6!  I'm getting good at *not* using features in VS2010 and instead trying to memorize where things are in code, and manually doing things outside of the IDE.  I typically don't have time to click on something and wait a little while for it to be found, or not function properly.

    I don't mean to be negative, but I'd really prefer VS.Next to be smaller and faster.

  • Hi, i hope it also can print colored source again ;)

  • Wow, I've been using Visual Assist for so long, that when I read the feature list, I kept thinking "Doesn't Visual Studio already do that -- oh wait, that must come from Visual Assist"

  • Hello,

    I would like to know Visual Studio vNext is going to be released. I am waiting for the native unit testing framework that is introduced in vNext and code coverage for Native C++ applications.  Kindly let me know.

  • wanna more C++0x/C++11 !!!

    And please, a little less confusion on the project proprieties, where we must set the VC++ dictionaries, the static libraries to the linker etc..

  • All of these are excellent, welcome enhancements IMO. Code Snippets -- finally!

    Unlike some other commentors, I *like* that the intellisense will start opening automatically.

    I'll be the obligatory poor C++/CLI dev and ask: this all works in mixed-mode code too, right? We know Intellisense is coming back (has Boris recovered from the beating?) so I do have hope that this works there too.

    In the solution explorer, will I be able the filter and then add breakpoints on all the functions I've filtered down to? Please!

    As a long-time Visual Assist user having much of this baked-in will be nice. The VAX guys are industrious and their fast release cycles should allow them to enhance your offering (it is extensible, right?).

    I'll add a +1 to the plea for performance in med to large projects. We have 1800-2000 cpp files and if you mistakenly press F12 in VS2010sp1 over a symbol, it's time to head for the breakroom...  Visual Assist by contrast takes you to the symbol instantly.

  • Thanks for the post.

    I think you are missing the boat with the features above. As jalf and others said, while the things you are showing off look somewhat useful, *unless* you are actually spending the majority of your time on the performance issues and are just keeping us in the dark about it, there is a pretty good chance that these new shiny features will only work at acceptable speed on small projects. You have been adding 'cool' features that never work on anything larger than model projects for quite some time, and it seems you are about to do this again with this vNext thing.

    Seriously, you are talking about adding features similar to parts of Class View to Solution Explorer and what I am actually thinking about is if there will be a way to turn this off. I am not using Class View in my projects. You know why? Because it is *slow*, so slow, it is unusable. So, my first thought upon hearing that you are about to add this new feature is whether or not I will be able to turn it off. And my first emotion is fear that I won't be able to turn it off completely, and, consequently, that vNext might be as slow or maybe even *slower* than VS2010. That does not look good, does it? But that's what I and a great many other people think, and how we feel.

    Stop adding new features. Get the existing features working at an acceptable level. That's all we ask.

  • Wow, they've implemented features that have been available in Eclipse few years ago.

  • Are users actually asking for more colorization?  I'd bet that most experienced developers know most code means, so the extra color just hinders readability.  I keep my colors to a minimum: black for code, green for comments.   I can tell strings apart because they have quotes.  I don't really need to be told in purple that something is an enumeration.  I only care if I am actually analyzing that bit of code, and hovering over it is adequate.

    My general feedback is that none of the above enhances my productivity; I can do my work without them.  Making the IDE stable and performant would enhance my productivity.

  • I cant see this page on Chrome, I Dont want to use the crap of IE 8/9 even Im on Windows so please do this page can render on other browsers too.

  • Here is something else that helps see the relative importance of bells and whistles like those shown in the post to the real thing, fixing the performance on medium-to-large projects, at least in C++. Some numbers from the Visual Studio UserVoice site:

    1. The suggestion that received the maximum number of votes (#1) is: "Move forward and bring back VS UI written in native code". This is strictly about performance. Users voting for this suggestion do so because they think that (a) the move to .NET is partly responsible for the heavy performance degradation of VS2010, and (b) moving back to unmanaged code will help restore performance.

    2. Suggestion #2 is: "Improve the performance of Visual Studio". Self-descriptive, the performance again.

    3. Suggestion #3 is not related to the performance, but #4 invariably gets us back to that topic: "Create x64 version of Visual Studio". Why is this about the performance? Because the author says so, his reason for the suggestion is: "I have to load some huge projects that would benefit of using access to full available RAM". I would imagine that most of the users who vote for this suggestion do so for similar reasons.

    Of the top 5 suggestions, 3 are essentially the same: please make VS faster, it is very slow, too slow to use. That's quite a message.

    Please listen to this message. Right now you aren't listening. You say you are, but your actions clearly show that you aren't. If you were, this blog post would have been about what you are doing about the performance, not about adding a couple of smarts here and there which will likely end up like your previous 'cool' features did - kind of interesting, although nothing one couldn't live without, but ultimately unusable anywhere but on smallest projects.

  • I want "Implement interface" feature in C++.

  • That is amazing! Can't wait for it.

  • PFYB, I don't think the problem is in Managed vs. Native.  For the most part, the use of managed code imposes a fixed proportional overhead that is easily compensated with better machines, and those who are complaining about perf on large projects are likely to have high-spec'd machine such as the one I am using (12GB/8-core, 16 with hyperthreading). The real problems probably have more to do with the number of interdependecies in the product that make simple operations take too long, not having the right kind of lookup algorithms, and probably various synchronization problems (VS also deadlocks on occasion).  You can also have all these problems in Native, plus the usual memory safety issues that go with C++.

  • Those interested in performance issues should take a look at:

    blogs.msdn.com/.../how-we-use-your-perfwatson-data-to-identify-unresponsive-areas.aspx

Page 2 of 4 (53 items) 1234