Template IntelliSense Improvements for Visual Studio 2019 Preview 2

Nick Uhlenhuth

Nick

In the first version of Template IntelliSense, we introduced the Template Bar which allowed you to provide sample arguments for your template in order to get a richer IntelliSense experience within the template body. Since then, we’ve received a lot of great feedback and suggestions which have led to significant improvements. Our latest iteration includes the following:

  • Peek Window UI
  • Live Edits
  • Nested Template support
  • Default Argument watermarks

Peek Window UI and Live Edits

Clicking the edit button on the Template Bar no longer brings up a modal dialog instead, it opens a Peek Window. The benefit of the Peek Window UI is that it integrates more smoothly into your workflow and allows you to perform live edits. As you type your sample template arguments, the IntelliSense in the template body will update in real-time to reflect your changes. This lets you quickly see how various arguments may affect your code. In the example below, we see that we get Member List completion for std::string, but we get a red squiggle when we change the sample argument to double.

Nested Template Support and Default Argument Watermarks

We’ve also improved our Template Bar support for nested templates. Previously, the Template Bar would only appear at the top-level parent. Now, the it appears at the template header of the inner-most template to the cursor. Note that even from within the member function template you will be able to modify the sample argument of the containing class template:

You’ll also notice that we auto-populate the Peek Window textbox with a watermark if there is a default argument (as in the case of V above). Keeping that textbox as-is will use the default value for IntelliSense; otherwise, you can specify a different sample argument.

Other Productivity Features in Preview 2

C++ Productivity Improvements in Visual Studio 2019 Preview 2

Talk to Us!

We’d love for you to download Visual Studio and give Template IntelliSense  a try. As always, we welcome your feedback. We can be reached via the comments below or via email (visualcpp@microsoft.com). If you encounter other problems with MSVC or have a suggestion for Visual Studio please let us know through Help > Send Feedback > Report A Problem / Provide a Suggestion in the IDE, or via Developer Community. You can also find us on Twitter (@VisualC).

Nick Uhlenhuth
Nick Uhlenhuth

Follow Nick   

4 Comments
Avatar
Søren Nielsen 2019-03-14 16:05:59
Could have been a nice feature if it wasn't for the fact that the information is stored outside the source file. In some special Visuals Studio files. If Visual Studio projects or solutions are not stored as part of the assets in my version control system, n other users of the source gets this.
Avatar
Denis Nikitin 2019-03-19 16:09:13
Is there any way to debug issues with this feature? I have a set of template classes, and no matter how I specify the arguments, all I get is a little error line "Error instantiating the template with provided arguments".