Visual Studio C++ Template IntelliSense Populates Based on Instantiations in Your Code

Nick Uhlenhuth

Nick

Ever since we announced Template IntelliSense, you all have given us great suggestions. One very popular suggestion was to have the Template Bar auto-populate candidates based on instantiations in your code. In Visual Studio 2019 version 16.1 Preview 2, we’ve added this functionality via an “Add All Existing Instantiations” option in the Template Bar dropdown menu. The following examples are from the SuperTux codebase. 

The Template Bar dropdown menu now contains a new entry, “Add All Existing Instantiations”.

 

 Clicking the “Add All Existing Instantiations” option will populate the dropdown, so you no longer need to manually type entries. 

 

Additionally, similar to Find All References, a window at the bottom of the editor shows you where each instantiation was found, and what its arguments were. 

  

Talk to Us! 

We hope this update addresses the popular customer feedback we received on Template IntelliSense! We’d love for you to download Visual Studio 2019 version 16.1 Preview 2 and let us know what you think. We can be reached via the comments below or via email (visualcpp@microsoft.com). If you encounter other problems with Visual Studio or have other suggestions you can use the Report a Problem tool in Visual Studio or head over to the Visual Studio Developer Community. You can also find us on Twitter (@VisualC). 

Nick Uhlenhuth
Nick Uhlenhuth

Follow Nick   

1 Comments
Piotr Maciejewski
Piotr Maciejewski 2019-04-24 18:59:53
This is a great feature and I think it would be great to add next nice option. For example, if I have many templates with the same typename argument "T":  template<typename T> struct A{}; template<typename T> struct B{}; template<typename T> struct C{}; It would be useful to use something similar to “Add All Existing Instantiations” to assign the same type to all "typename T" occurrences.  Then with one click I could tell intellisense to assing for example uint32_t for all typename T.