{"id":32445,"date":"2023-06-28T16:40:16","date_gmt":"2023-06-28T16:40:16","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=32445"},"modified":"2024-04-03T09:34:12","modified_gmt":"2024-04-03T09:34:12","slug":"c-extension-in-vs-code-1-16-release-call-hierarchy-more","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/c-extension-in-vs-code-1-16-release-call-hierarchy-more\/","title":{"rendered":"C++ Extension in VS Code 1.16 Release: Call Hierarchy &#038; more"},"content":{"rendered":"<p><span data-contrast=\"auto\">The <\/span><a href=\"https:\/\/github.com\/microsoft\/vscode-cpptools\/releases\/tag\/v1.16.2\"><span data-contrast=\"auto\">1.16 version<\/span><\/a><span data-contrast=\"auto\"> of the C++ Extension in VS Code has now been shipped. With this version of the extension, <\/span><span data-contrast=\"auto\">we are releasing one of our <\/span><a href=\"https:\/\/github.com\/microsoft\/vscode-cpptools\/issues\/16\"><span data-contrast=\"none\">most upvoted GitHub feature requests<\/span><\/a><span data-contrast=\"auto\"> \u2013 Call Hierarchy. <\/span><span data-contrast=\"auto\">We also added new functionality when creating declarations and definitions that allows you to copy the declaration\/definition and specify its placement in code, as well as adding other code enhancements. For the full list of changes, please reference the <\/span><a href=\"https:\/\/github.com\/microsoft\/vscode-cpptools\/releases\/tag\/1.16.0\"><span data-contrast=\"none\">1.16 release notes.<\/span><\/a><span data-contrast=\"auto\">\u00a0<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;201341983&quot;:0,&quot;335559738&quot;:300,&quot;335559739&quot;:300,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h3 aria-level=\"2\"><b><span data-contrast=\"none\">Call Hierarchy\u00a0<\/span><\/b><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h3>\n<p aria-level=\"2\"><span data-contrast=\"auto\">With call hierarchy, you can now easily navigate your codebase, especially when trying to understand the complex calling relationships between functions. This might be a familiar experience if you have used call hierarchy in Visual Studio. Here you can see it in action: <\/span><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p aria-level=\"2\"><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/Call_Hierarchy.gif\"><img decoding=\"async\" class=\"aligncenter wp-image-32446\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/Call_Hierarchy.gif\" alt=\"The gif shows a user navigating to their call hierarchy by right clicking a function with a Quick Fix available, then selecting &quot;Show Call Hierarchy&quot;. This opens a side bar with all the calls. The user then clicks on the phone icon in the menu of the side bar to toggle between calls from and calls to for that function.\" width=\"634\" height=\"497\" \/><\/a><\/p>\n<h4 aria-level=\"2\"><span data-contrast=\"none\">How can you view\u00a0the call hierarchy?\u00a0<\/span><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h4>\n<p><span data-contrast=\"auto\">To view the call hierarchy, right-click a function to display the context menu and select <strong>Show Call Hierarchy<\/strong>. This will populate the call tree in the side bar with all of the functions called by your selected function. Toggle the phone icon in the side bar menu to switch to incoming calls. Incoming calls will show whenever your function is referenced by another function.<\/span><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/Context_Menu_Call_Hierarchy-e1687557041425.jpg\"><img decoding=\"async\" class=\"aligncenter wp-image-32448 \" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/Context_Menu_Call_Hierarchy-e1687557041425.jpg\" alt=\"Image showing that the command in the context menu to look for is called &quot;show call hierarchy&quot;\" width=\"405\" height=\"196\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/Context_Menu_Call_Hierarchy-e1687557041425.jpg 770w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/Context_Menu_Call_Hierarchy-e1687557041425-300x145.jpg 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/Context_Menu_Call_Hierarchy-e1687557041425-768x371.jpg 768w\" sizes=\"(max-width: 405px) 100vw, 405px\" \/><\/a><\/p>\n<p><span data-contrast=\"auto\">You can also invoke the command palette (Ctrl + Shift + P) and run the command <strong>Calls: Show Call Hierarchy<\/strong> to display the call hierarchy side bar. <\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;201341983&quot;:0,&quot;335559738&quot;:300,&quot;335559739&quot;:240,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/call_hierarchy_command_palette.jpg\"><img decoding=\"async\" class=\"aligncenter wp-image-32447\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/call_hierarchy_command_palette-1024x115.jpg\" alt=\"Image that shows that the command for call hierarchy in the command palette is called &quot;show call hierarchy&quot;.\" width=\"604\" height=\"68\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/call_hierarchy_command_palette-1024x115.jpg 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/call_hierarchy_command_palette-300x34.jpg 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/call_hierarchy_command_palette-768x86.jpg 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/call_hierarchy_command_palette.jpg 1428w\" sizes=\"(max-width: 604px) 100vw, 604px\" \/><\/a><\/p>\n<p><span data-contrast=\"auto\">Additionally, you can explore nested calls by selecting a function already shown in the call tree and right-clicking on that function to view the available commands. <\/span><\/p>\n<p><a style=\"color: #006f94; text-decoration-line: underline; outline-width: 0px;\" href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/Nested_Calls_Call_Hierarchy.jpg\"><img decoding=\"async\" class=\"aligncenter wp-image-32450\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/Nested_Calls_Call_Hierarchy.jpg\" alt=\"Image shows that if you right click on a function displayed in the call hierarchy call tree, you will be able access another menu which gives you the option to find incoming\/outgoing calls for that sub function\" width=\"405\" height=\"196\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/Nested_Calls_Call_Hierarchy.jpg 814w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/Nested_Calls_Call_Hierarchy-300x145.jpg 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/Nested_Calls_Call_Hierarchy-768x372.jpg 768w\" sizes=\"(max-width: 405px) 100vw, 405px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3 aria-level=\"2\"><b><span data-contrast=\"none\">Copy Declaration\/Definition<\/span><\/b><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h3>\n<p><span data-contrast=\"auto\">After releasing the Create Declaration\/Definition feature in <\/span><a href=\"https:\/\/github.com\/microsoft\/vscode-cpptools\/releases\/tag\/v1.13.6\"><span data-contrast=\"none\">version 1.13.6,<\/span><\/a><span data-contrast=\"auto\"> you can now also copy that declaration or definition. Rather than using \u201cCreate Declaration\/Definition\u201d to automatically add a generated declaration or definition to a location chosen by the extension, \u201cCopy Declaration\/Definition\u201d will copy the declaration or definition to your clipboard instead. This gives you the option to decide where exactly in your code you would like to paste the copied declaration or definition.\u00a0 <\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">To copy a definition or declaration, select a function that has a Quick Fix available (three dots under the function name), then select the Code Action (lightbulb icon) on the left. This will open the Code Action options, where you can select \u201cCopy definition of \u2018YourFunctionName\u2019\u201d or \u201cCopy declaration of \u2018YourFunctionName\u2019\u201d depending on which is being created. <\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:2,&quot;335551620&quot;:2,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\"><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/Copy_DeclDef_Feature.gif\"><img decoding=\"async\" class=\"aligncenter wp-image-32449 \" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/06\/Copy_DeclDef_Feature.gif\" alt=\"Gif showing that when you are creating a declaration\/definition, when you click on the function, rather than selecting &quot;create declaration&quot; you will select &quot;copy declaration&quot; and vice versa for declarations.\" width=\"747\" height=\"521\" \/><\/a><\/span><\/p>\n<p><span data-contrast=\"auto\">If the Declaration\/Definition is not formatted for you when you paste, you can turn on auto formatting by navigating to the settings editor (Ctrl + ,) and searching for <\/span><b><span data-contrast=\"auto\">Format On Paste<\/span><\/b><span data-contrast=\"auto\">. Enabling this will automatically formal all items you paste into the editor. <\/span><span data-contrast=\"none\">\u00a0<\/span> <span data-contrast=\"auto\">\u00a0<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;201341983&quot;:0,&quot;335559738&quot;:300,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h3><b><span data-contrast=\"auto\">What do you think?<\/span><\/b><span data-contrast=\"auto\">\u00a0<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;201341983&quot;:0,&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559738&quot;:0,&quot;335559739&quot;:240,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h3>\n<p><a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-vscode.cpptools\"><span data-contrast=\"auto\">Download the C\/C++ extension for Visual Studio Code <\/span><\/a><span data-contrast=\"auto\">\u202ftoday, give it a try, and let us know what you think.\u00a0<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;201341983&quot;:0,&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559738&quot;:0,&quot;335559739&quot;:240,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">If you have any questions around this release, feel free to start a discussion in <\/span><a href=\"https:\/\/github.com\/microsoft\/vscode-cpptools\/discussions\"><span data-contrast=\"auto\">our GitHub repository.<\/span><\/a><span data-contrast=\"auto\"> Otherwise, if you run into any issues, please report them in the \u202f<\/span><a href=\"https:\/\/github.com\/Microsoft\/vscode-cpptools\/issues\"><span data-contrast=\"auto\">issues section<\/span><\/a><span data-contrast=\"auto\">. We can be reached via the comments below, per email at\u202f <\/span><a href=\"mailto:visualcpp@microsoft.com\"><span data-contrast=\"auto\">visualcpp@microsoft.com,<\/span><\/a><span data-contrast=\"auto\"> or through our team on Twitter at \u202f<\/span><a href=\"https:\/\/twitter.com\/visualc\"><span data-contrast=\"auto\">@<\/span><\/a><a href=\"https:\/\/twitter.com\/visualc\"><span data-contrast=\"auto\">VisualC.<\/span><\/a> <span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;201341983&quot;:0,&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559738&quot;:0,&quot;335559739&quot;:240,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The 1.16 version of the C++ Extension in VS Code has now been shipped. With this version of the extension, we are releasing one of our most upvoted GitHub feature requests \u2013 Call Hierarchy. We also added new functionality when creating declarations and definitions that allows you to copy the declaration\/definition and specify its placement [&hellip;]<\/p>\n","protected":false},"author":101195,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-32445","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cplusplus"],"acf":[],"blog_post_summary":"<p>The 1.16 version of the C++ Extension in VS Code has now been shipped. With this version of the extension, we are releasing one of our most upvoted GitHub feature requests \u2013 Call Hierarchy. We also added new functionality when creating declarations and definitions that allows you to copy the declaration\/definition and specify its placement [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/32445","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\/101195"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=32445"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/32445\/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=32445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=32445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=32445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}