{"id":20778,"date":"2018-06-26T13:40:58","date_gmt":"2018-06-26T20:40:58","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vcblog\/?p=19545"},"modified":"2019-02-18T17:47:53","modified_gmt":"2019-02-18T17:47:53","slug":"template-intellisense","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/template-intellisense\/","title":{"rendered":"Announcing Template IntelliSense"},"content":{"rendered":"<p><span>C++ developers using function templates and class templates can now take full advantage of IntelliSense within their template bodies. In Visual Studio 2017 15.8 Preview 3, when your <\/span><span>caret <\/span><span>is <\/span><span>inside a template, a new UI element called a \u201cTemplate Bar\u201d appears next to the template definition. The Template Bar allows you to provide sample template arguments for IntelliSense.<\/span><span>\u00a0<\/span><\/p>\n<p><span>For example, let\u2019s look in the <\/span><span>Boost library at the function template <\/span><b><i><span>is_partitioned_until<\/span><\/i><\/b> <span>inside of algorithm.hpp (which I slightly modified for this demo<\/span><span>). We can use the Template Bar to give IntelliSense an example of the <\/span><i><span>InputIterator <\/span><\/i><span>type<\/span> <span>and the <\/span><i><span>UnaryPredicate<\/span><\/i><span> type.<\/span><span>\u00a0<\/span><\/p>\n<ul>\n<li><span>Click the <\/span><strong>&lt;T&gt;<\/strong><span> icon to expand\/collapse the Template Bar.<\/span><span>\u00a0<\/span><\/li>\n<li><span>Click the pencil icon or double-click the Template Bar to open the Edit window.<\/span><span>\u00a0<\/span><\/li>\n<\/ul>\n<p><span><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/templateGif1.gif\"><img decoding=\"async\" width=\"879\" height=\"239\" class=\"alignnone size-large wp-image-19555\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/templateGif1.gif\" \/><\/a><\/span><\/p>\n<p><span>Notice that <\/span><span>we<\/span><span> were able to use decltype on the UnaryPredicate called myPredicate. With this information provided, we have the full power of IntelliSense while we edit the template body. We get all the proper squiggles, quick info, parameter help, etc.<\/span><span>\u00a0<\/span><\/p>\n<p><span>We are considering the Template Bar information to be user-specific, thus it is stored in the .vs folder and not shared on commits.<\/span><span>\u00a0<\/span><\/p>\n<h3><span>W<\/span><span>hat\u2019s Next<\/span><span>?<\/span><span>\u00a0<\/span><\/h3>\n<p><span>Download the latest <\/span><a href=\"https:\/\/www.visualstudio.com\/vs\/preview\/\"><span>Visual Studio 2017 Preview<\/span><\/a><span> and try it with your projects. To disable\/enable the feature, go to <\/span><i><span>Tools &gt; Options &gt; C\/C++ &gt; Advanced &gt; IntelliSense &gt; Enable Template IntelliSense<\/span><\/i><span>.<\/span><span>\u00a0<\/span><\/p>\n<p><span>We will continue to improve this feature in subsequent releases. We already have plans to support nested templates and to <\/span><span>handle<\/span><span> edits outside of Visual Studio.<\/span><span>\u00a0<\/span><\/p>\n<p><span>As with all new features, your feedback is<\/span><span> very important <\/span><span>in helping<\/span><span> guide our development. You can send me your <\/span><span>feedback<\/span><span> on Twitter <\/span><a href=\"https:\/\/twitter.com\/NickUhlenhuth\"><span>@nickuhlenhuth<\/span><\/a><span>, or reach out to the Visual Studio C++ team <\/span><a href=\"https:\/\/twitter.com\/visualc\"><span>@visualc<\/span><\/a><span> or <\/span><span>visualcpp@microsoft.com<\/span><span>.<\/span><span>\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>C++ developers using function templates and class templates can now take full advantage of IntelliSense within their template bodies. In Visual Studio 2017 15.8 Preview 3, when your caret is inside a template, a new UI element called a \u201cTemplate Bar\u201d appears next to the template definition. The Template Bar allows you to provide sample [&hellip;]<\/p>\n","protected":false},"author":329,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[270,1,230],"tags":[],"class_list":["post-20778","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-announcement","category-cplusplus","category-new-feature"],"acf":[],"blog_post_summary":"<p>C++ developers using function templates and class templates can now take full advantage of IntelliSense within their template bodies. In Visual Studio 2017 15.8 Preview 3, when your caret is inside a template, a new UI element called a \u201cTemplate Bar\u201d appears next to the template definition. The Template Bar allows you to provide sample [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/20778","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/329"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=20778"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/20778\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/35994"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=20778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=20778"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=20778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}