C++ IDE Improvements in Visual Studio 2013

C++ IDE Improvements in Visual Studio 2013

Rate This
  • Comments 27

When we considered what features to add to the C++ IDE in Visual Studio 2013, we decided to focus on improving the C++ code editing experience. We've added a number of features that will help you write and format your code more quickly, and will give you more useful information in IntelliSense. You can configure the behavior of most of these new features using the Options dialog from the Tools menu.

Code Formatting

One of my biggest frustrations with the C++ editor in Visual Studio over the past several years has been the lack of formatting when I pasted code into the editor. Combined with the lack of many common code formatting settings, this meant I spent quite a bit of time making my code look how I wanted, rather than actually writing new code.

In Visual Studio 2013 we added over 40 settings to help you control when and how your C/C++ code is formatted. We realize that there are many common formatting conventions for C/C++ code, so rather than dictate a single style of code formatting, we aim to give you the flexibility to adapt the settings to match your existing coding standards.

In some cases, we know that none of the options provided might be what you want. One particular example of this is controlling the exact position of opening curly braces for various block types. For these settings, we added an option to not apply a particular formatting rule so that you can control a particular aspect of your code formatting without needing to turn off formatting globally.

It's also possible to take advantage of code formatting without applying it automatically – simply go to the Text Editor -> C/C++ -> Formatting -> General page in the Options dialog, and uncheck all the boxes to turn off the auto-formatting behavior. You can then manually format your code using the Format Document and Format Selection commands from the Edit -> Advanced menu. This can be helpful if different areas of your codebase use different formatting standards, or if you need to make changes to 3rd party library code in your solution.

IntelliSense Improvements

We made some changes to Member List and Parameter Help so they provide more relevant information.

The Member List window now hides private members of types, except when you're editing code that defines the type.

The Parameter Help tooltip that appears when typing parameters of an overloaded function will now automatically switch to the best matching overload based on the number of parameters you've typed thus far. And it properly handles nested function calls – when you start typing a nested function call, Parameter Help will display results relevant to the nested call, then restore the contents of the tooltip to the outer function call when you close the argument list.

Small Changes that make a Big Difference

Have you ever used the "Go To Header File" command from the editor context menu? Now you can toggle back and forth between a header and its corresponding code file. There's even a default keyboard shortcut – Ctrl + K, Ctrl + O.

The editor can auto-generate event handlers in C++/CX and C++/CLI code files. You can choose to auto-generate just the delegate instance, or both the delegate instance and event handler function (both definition and declaration).

You may remember that In Visual Studio 2010, we changed Find All References to show just textual matches by default. You could have opted to have the compiler verify whether the textual results were actual matches.

We've changed Find All References to automatically resolve matches incrementally in the background after the textual matches are displayed – you don't have to resolve the references in order to get the information from the compiler.

We also added a toolbar to the Find Symbol Results window so it's easier to navigate the results and to stop resolution if desired.

And the Project Properties window is (finally) resizable.

Other Features

C++ developers can also take advantage of the improvements made to the common Visual Studio code editor, such as Peek Definition, Brace Completion, Enhanced Scrollbar, and updated Navigate To. You can learn more about these features in the Visual Studio blog post "Visual Studio 2013 New Editor Features".

Your Feedback Matters

One of the main reasons we ship preview releases of Visual Studio is to get your feedback and bug reports on new features and functionality, so we can fix the main issues before the RTM release. We regularly review bugs and other feedback reported via Connect and through the Visual Studio Send a Smile feature. As of this writing, the Visual Studio 2013 Preview has been available for about two months. Since that time we've fixed 14 bugs that you've reported (and several others we've found internally). Please keep on sending your feedback and reporting bugs. Even though we may not be able to fix every issue or respond to each piece of feedback, please know that we do read and consider all feedback we receive.

Wrap-up

For the complete list of Visual C++ IDE features in Visual Studio 2013, check out the What's New for Visual C++ in Visual Studio 2013 Preview page. And if there are features you'd like to see us add to the C++ IDE in future versions of Visual Studio, please vote for them on our UserVoice site.

  • As one who's given you heck in the past for dropping the ball in the IDE (has anyone seen Boris since C++/CLI intellisense went away?) I feel I must applaud these changes. Thank you for keeping the C++, C++/CLI and C++/CX developers in mind with IDE updates.

    Next stop, refactoring? Pretty please!

  • Very pleased with the changes.

    Would be great if you could look into IntelliSense stalling. E.g., sometimes, if there is a small error in project somewhere, IntelliSense can completely stall and act "stupid" (forget how to colour code stuff) across multiple open files in this project until that error is fixed.

  • I would love to have a way to refactor stuff. Being able to easily rename a class, function, or variable across all my C++ code is something I seriously want.

  • Why don't you just buy Visual Assist and integrate it like you usually did with other software? Why don't you make some agreement with them because to use VAX one need to have a Professional+ Visual Studio (in theory an active license), so you can get a pretty good refactoring tool with IDE (something like Atmel made with their IDE) without this "we're adding one feature in VS2010, another in VS2012.... another one in VS2050...".

  • I'm hugely enjoying working with C++ using the VS2013 IDE, so much so that VS2012 feels painful by comparison - so big ups to the team right there.

    Anything you can do by RTM or in subsequent updates / major releases to continue to improve ( reduce ) start up time out be hugely appreciated.

    Also, C++, and indeed all the VS languages would greatly benefit from a improved search result experience. I long for the day when VS rather than replacing the previous search results would instead just append to them. 2 search results buffers are inadequate, where as a single, continuous display of search results better supports exploratory spelunking though large codebases. A 'infinite' search results history helps to maintain a useful cognitive breadcrumb trail I find.

  • I addition to Tom Kirby-Green's comment, there are some usability issues with how search results are displayed.

    In VS 2013, when we press Ctrl+Shift+F, enters the search-term and press Find All, it shows the search results but the count is displayed at the end of the results. For an instance:

    "Matching lines: 13 Matching files: 7 Total files searched: 69"

    From user experience point of view, its very inconvenient to go to the end to get this information. IMO, it should be displayed at the top of the result window.

    Also, it would be great, if in the mini-find Ctrl+F and Find-and-Replace popups Ctrl+Shift+F, the count like "3 of 19 records" (the same approach IE team has used in Find on Page feature).

  • In search results, rather than showing the entire path of each file, the result set can be displayed as a tree view. Considering the following results:

    Find all "view", Match case, Subfolders, Find Results 1, Current Project: CBES - Crowd Monitor\CBES - Crowd Monitor.csproj, ""

    C:\Users\win-user\Documents\Visual Studio 2010\Projects\CBES - Crowd Monitor\CBES - Crowd Monitor\Content\themes\base\jquery.ui.theme.css(15): * To view and modify this theme, visit jqueryui.com/themeroller

    C:\Users\win-user\Documents\Visual Studio 2010\Projects\CBES - Crowd Monitor\CBES - Crowd Monitor\Scripts\jquery-1.5.1-vsdoc.js(2732): props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),

    C:\Users\win-user\Documents\Visual Studio 2010\Projects\CBES - Crowd Monitor\CBES - Crowd Monitor\Scripts\jquery-1.5.1.js(2585): props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),

    ... it can be displayed in a tree-view like:

    Find all "view", Match case, Subfolders, Find Results 1, Current Project: CBES - Crowd Monitor\CBES - Crowd Monitor.csproj, ""

    ▼ C:\Users\win-user\Documents\Visual Studio 2010\Projects\CBES - Crowd Monitor\CBES - Crowd Monitor\

    |

    | ▼ Content\themes\base\jquery.ui.theme.css

    | 15: * To view and modify this theme, visit jqueryui.com/themeroller

    |

    | ▼ Scripts\

    | ▼ jquery-1.5.1-vsdoc.js

    | 2732: props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),

    |

    | ▼ jquery-1.5.1.js

    | 2585: props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),

    IMO, this way it would look more elegant and compact!

  • Please restore Brief editor support

  • Thanks very much for these IDE improvements for C++!  The Code Formatting improvements especially will be a huge help.

  • @Tom Kirby-Green @Nate @Flora Thanks for the feedback on Find in Files.  Improving Find in Files results is something we've been discussing with the core VS editor team but we don't have a specific plan or target release yet.

    @ John Schroedl @ Peter Atashian Refactoring is also on the backlog - we're keenly aware of this request.  

    Setting aside renaming refactoring operations for a moment (I know those are the most popular), what other refactoring operations are most important to you?

  • The most basic refactorings (beyond Rename) I would want for C++ would include:

    Optimize Includes: Figure out the minimal or proper set of #includes I should have based on usage.

    Add Include: Add a #include for a usage (similar to add using for C# code)

    Create declaration: Put the prototype into the class definition

    Create implementation: Create a stub in the .cpp file for a particular prototype.

    Extract member function: Select some code and make a member for me.

    Implement interface: Override the virtuals in a base class.

    Find duplicate code: Code cloning analysis similar to existing C# feature.

  • Other refactorings I meant to mention:

    Create Copy Constructor  -- (optionally with =delete)

    Create Move Constructor

    Create Assignment Operator

    Create Move Assignment Operator

  • There is an issue with some of the code formatting options. For example, "Spacing for function parenthesis" has options that are always enforced. I am especially concerned with the "Insert space between function names and opening parenthesis of argument lists" option, because it either adds or removes spaces for all cases, and we use two different cases: insert space for function signatures / declarations, and don't insert space for function calls. So, the automatic formatting is messing all our code and we have to completely disable it since it doesn't have an option like "Don't change spaces" there.

  • Is it possible to implement the 'running history'? Although I myself always doubt if it was possible to made out.

     Assuming we are testing a project(in Debug mode, of course). The program in it is multi-threads and complicated made and the testing has passed for minutes or hours or even days. Suddenly an exception is thrown without handled by the program itself and the program is stopped by debugger in VS IDE. A dialog of the VS has popped up and shows the place and the type of the exception thrown... (and which is the experience as we familiar). But here is the different with the normal: In next minutes, we close the dialog, then pick up an icon with the tip 'Review What Just Happened ...' then you can see what's really happened before the exception thrown, step by step(To avoiding logged huge/slow/memory taken it can limited to only several hundreds steps before reaching to the current break-point), and then you find out what reason the exception is caused by.

  • You can see the history of call-stacks, register, variables... Just like a time-logged mini-dump viewer. Comparison to the mini-dump viewer there is now, it is dynamically, not just a freezing snapshot.

Page 1 of 2 (27 items) 12