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]

  • Thanks for the preview of features specific to code understanding and editing.  Those of us in the development community that use VS 2010 daily certainly appreciate efforts to make our work more productive.  Having said that, I hope that Microsoft is paying very close attention to the performance of the IDE when working with large solutions.  It's not just the bells and whistles that matter - the IDE must be very responsive to the basic commands as well.  It is not uncommon for solutions to encompass over 100,000 LOC nowadays, and this seems to be pushing the limits of the VS 2010 IDE.  Making the IDE more responsive is a wish that many of us have.  I hope Microsoft is able to deliver on that wish with Visual C++ vNext.  I would personally like to see a blog on what is being done with vNext to address this specific issue.

  • It's about time they caught up with Visual Assist and other 3rd party add on makers, though I'm guessing those guys won't be too happy about this (assuming it works well).

  • Any plans for reference-based renaming or other convenient refactoring enhancements?

  • Did you guys ever use a large project to test? May be MS guys always are working in the sand box. Please!Please! Performance!performance!

  • We could get those small improves from 3rd party addons,but can NOT get good performance from them.

    I mean the real performance,not guys says in the "10 is the new 6" blog post.

  • The Solution Explorer seems largely unchanged from the extension, though that's certainly not a bad thing. Is C++ support new for it?

    It'll be nice to be able to drop the nice, but somewhat unreliable Highlighterr extension. If any language would benefit from semantic highlighting, it's C++! I'll be interested to see how well it deals with templates, macros, multiple definitions, invalid source and the like.

    Hopefully that fuzzy matching sorts by if the first char matches, then by longest match, or something similarly smart - I've had bad experience with naive matching "abc" as "*a*b*c*" by alphabetical order.

    If you have, could you talk about any changes you've made to the build system? Eg. did you decide to drop .vcxproj.filters? Are you solving the problem with "src/A/foo.cpp" and "src/B/foo.cpp" both building to "Debug/foo.obj", breaking the build? Simplifiying or better exposing adding build steps in any way? Improving the project settings perf. problems with hand-modified .vcxproj files? Simply generating better .vcxproj source in the first place? None of these are serious, but they seem to be what most annoys me about VC10 at the moment.

  • I also really hope the search feature in the solution explorer supports projects with 1 MLOC, and doesn't just becomes a performance bottleneck like "quick" search feature in VS2010

    I also hope it is possible in the new Solution Explorer to only search for files, so it doesn't automatically expand to class member names. The "quick" search displayed both classes and files, and many times the search result became too big to navigate, and files was not ranked highest.

  • The automatic display of Intellisense is a horrible idea. It will constantly obscure code above/below which you tend to want to reference while typing a line of code.

    It's quite rare to write new code top-down - in any non-linear editing, this will just get in the way.

  • I think all of this looks fantastic, particularly the aggressive intellisense, (as long as there's an option to turn it off) -- presumably this will come with suggestion-mode? Is there a "substring mode" between fuzzy logic and prefix, I really notice the difference using VCS2010 substring intellisense and VC++2010 prefix syntax.

  • @Lars: press a control key to make the intellisense window transparent.

  • @Sumit will there be an option to disable automatic display from intellisense?

  • as others have already hinted, this looks nice, but I can't help feeling that you're adding a few bells and whistles to automate or speed up a few  more specific, narrowly-defined and "predictable" tasks, while still doing nothing about the real productivity killers:

    - the IDE being dog slow most of the time

    - many dialogs ('New Item' is a prime example) being cluttered, badly designed, and practically requiring several mouse clicks and often some scrolling (what's with the C++-specific 'New Item' dialog suggesting a Windows Form as the first item, *above* the .cpp file option? Which do you think a C++ developer needs most often?). The entire project wizard is in need of an overhaul as well. Then there is everyone's pet peeve of the non-resizable properties dialog, or the ridiculous number of dialogs being modal or for no particular reason.

    And there's the usual caveat that "those new intellisense-related features look great, but they'll be useless when you're writing a template function".

    Honestly, the VC++ IDE needs a revamp of the core functionality much more than it needs autocompletion or colored references (which, again, will only work in non-template code, presumably)

    If you could make it possible to add a .cpp or a .h file in less than 30 seconds, preferably without a modal dialog locking up the entire IDE in the meantime, I'd be much more impressed.

    Honestly, I'd rather see a more streamlined and lightweight IDE, than these conditional features that only actually work if a half-dozen conditions are satisfied (Version >= Professional && no templates in sight && Intellisense not freaking out over PCH's being disabled && Intellisense having had 10 minutes to scan the relevant source files &&  ...........)

    The "productivity features" I want the most are removal of the roadblocks that *prevent* me from using the IDE, rather than it's new bells and whistles on top of the current IDE:

    - fewer (no) modal dialogs. Heck, even the "are you sure you want to close" dialog doesn't *really* need to be modal, does it? What if I want to add a final semicolon to the code just before hitting 'ok' on the close dialog?

    - less blocking behavior. Whether it's an in-progress build, a debugging session or Intellisense parsing code, it shouldn't make the IDE nonresponsive, or even disable functionality (such as preventing me from.

    - better designed, more streamlined dialogs (and perhaps removal of the dialogs containing information that could be presented without popping up a dialog)

    - and just a faster, more responsive IDE. Having to wait for my IDE isn't going to make me more productive. Performance, please!

  • These are great new features. Any chance now that you've got "Reference Highlighting" to add a simple rename refactoring support?

  • Could you consider posting about the features of the recently standardized C++11 that will make it VC++.next?

  • "> I'd rather see a more streamlined and lightweight IDE, than these conditional features that only actually work if a half-dozen conditions are satisfied (Version >= Professional && no templates in sight && Intellisense not freaking out over PCH's being disabled && Intellisense having had 10 minutes to scan the relevant source files &&  ...........)"

    Very good points here and the overall (lack of) snappiness of the environment why I still do everything in 2008 while having 2010 installed.

    One possible solution is to have the C++ compiler compile C# language (or have some type of preprocessing translation step that's transparent to user), with some restrictions where necessary to preserve performance. Then additional C++ performance features can be right next to this C#. ID software's guru John Carmack infact proposed they'd go for this type of approach in future.

Page 1 of 4 (53 items) 1234