Template IntelliSense Improvements for Visual Studio 2019 Preview 2

Nick Uhlenhuth

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).


Discussion is closed. Login to edit/delete existing comments.

  • Søren Nielsen 0

    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.

    • Nick UhlenhuthMicrosoft employee 0

      Thanks for the feedback. Right now we intentionally made the information stored outside of source. One of the reasons was so that another user who might prefer a different set of arguements won’t override your argument preferences when you pull. Sharing the Template Bar information is an interesting idea, please create a suggestion here and comment back with a link so that others can upvote.

  • Denis Nikitin 0

    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”. 

    • Nick UhlenhuthMicrosoft employee 0

      Hmm, do you get the error even if you specify “int”? I’m not sure what you’ve tried, but you have to use valid input. Typing gibberish will cause an error since it is based on IntelliSense. As a side note, it sounds like we should look into making the error messages more specific when possible.

Feedback usabilla icon