{"id":15485,"date":"2017-04-25T09:16:44","date_gmt":"2017-04-25T17:16:44","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vcblog\/?p=15485"},"modified":"2019-02-18T17:48:31","modified_gmt":"2019-02-18T17:48:31","slug":"visual-studio-code-cc-extension-april-2017-update","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/visual-studio-code-cc-extension-april-2017-update\/","title":{"rendered":"Visual Studio Code C\/C++ extension April 2017 Update"},"content":{"rendered":"<p>Earlier today we shipped the April 2017 update to the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-vscode.cpptools\">C\/C++ extension for Visual Studio Code<\/a>. We are excited to introduce the following new features in this update:<\/p>\n<ul>\n<li><strong>Error Squiggles<\/strong><\/li>\n<li><strong>Quick Info<\/strong><\/li>\n<li><strong>Go to Declaration<\/strong><\/li>\n<li><strong>Bash on Windows debugging support<\/strong><\/li>\n<\/ul>\n<p>The <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/cc-extension-for-visual-studio-code\/\">original blog post<\/a> has been updated with these changes. If you have this extension installed already, Visual Studio Code sends a notification for the update and installs the update for you automatically. If you haven\u2019t installed it before, <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-vscode.cpptools\">download the C\/C++ extension for Visual Studio Code<\/a> to try it out.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/1-download.png\"><img decoding=\"async\" width=\"600\" height=\"148\" class=\"alignnone wp-image-15495\" alt=\"1-download\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/1-download-1024x253.png\" \/><\/a><\/p>\n<h2>Error Squiggles and Quick Info<\/h2>\n<h3>Enabling the features<\/h3>\n<p>In this update, we\u2019re shipping Error Squiggles and Quick Info as \u201cexperimental features\u201d. What this means is that they are turned on by default only for those using <a href=\"https:\/\/code.visualstudio.com\/insiders\">VSCode Insiders<\/a>, and off by default for anyone else. You can enable or disable the features by toggling the setting in the settings.json file (File-&gt;Preferences-&gt;Settings). In the settings file, search for \u201cintellisense\u201d to locate the <strong><em>C_Cpp.intelliSenseEngine<\/em><\/strong> setting, and set it to \u201cDefault\u201d to enable the new IntelliSense Engine (see the following screenshot). \u201cDefault\u201d will become the true default for everyone when these features exit their experimental state. \ud83d\ude42<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/2-intellisense-engine.png\"><img decoding=\"async\" width=\"879\" height=\"528\" class=\"alignnone size-large wp-image-15505\" alt=\"2-intellisense-engine\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/2-intellisense-engine.png\" \/><\/a><\/p>\n<p>The \u201cC_cpp.errorSquiggles\u201d setting in the same file allows turning on or off the squiggle feature when the default IntelliSense engine is used.<\/p>\n<p>We encourage you to turn on the features, try them out, and send us feedback so we can further polish these features and turn them on by default soon.<\/p>\n<h3>Error Squiggles<\/h3>\n<p>A while back we enabled showing error squiggles for the #include statements. This update adds support for showing squiggles under any program element, including variables, keywords, and braces, if a workspace exists. In other words, squiggles are not enabled when only single files are open.<\/p>\n<p>For example, in the following screenshot, Vector3 has a red squiggly underline, indicating this type can\u2019t be found in the specified include paths.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/3-quick-action.png\"><img decoding=\"async\" width=\"879\" height=\"408\" class=\"alignnone size-large wp-image-15515\" alt=\"3-quick-action\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/3-quick-action.png\" \/><\/a><\/p>\n<p>Clicking on Vector3 in the code, you will see a light bulb on the left side of the line. The \u201cAdd include path to settings\u201d menu on the light bulb will take you to the <strong><em>c_cpp_properties.json<\/em><\/strong> file in which you can specify the include paths for IntelliSense. If the c_cpp_properties.json file does not already exist, it will be created and populated with the following default include paths:<\/p>\n<ul>\n<li>On Windows, we default to the workspace root, the VC include path if Visual Studio 2017 or 2015 is installed, and the latest Windows SDK if found.<\/li>\n<li>On Linux, we default to the workspace root, the highest version of the includes found in <em>\/usr\/include\/c++<\/em>, 64-bit specific headers if they are present, and headers found under \/usr\/lib\/clang if present.<\/li>\n<li>On Mac, we default to the workspace root and the Xcode default toolchain if present or the same paths as Linux if Xcode is not found.<\/li>\n<\/ul>\n<p>You can add, remove, or modify the paths in the <strong><em>includePath<\/em><\/strong> setting to fit your scenario. In this example, I added another path (highlighted with the red underline) for the IntelliSense engine to look for types.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/4-include-paths.png\"><img decoding=\"async\" width=\"879\" height=\"452\" class=\"alignnone size-large wp-image-15525\" alt=\"4-include-paths\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/4-include-paths-1024x526.png\" \/><\/a><\/p>\n<p>Note that there\u2019s a newly-added \u201cpath\u201d setting under \u201cbrowse\u201d, which is used by the tag parser for performing fuzzy search results. The \u201cincludePath\u201d setting, which was formerly used by the tag parser, now controls the include paths for the new IntelliSense engine. On opening any existing <strong><em>c_cpp_properties.json<\/em><\/strong> files, the value in the \u201cincludePath\u201d is automatically copied into the \u201cbrowse.path\u201d setting.<\/p>\n<p>You can also configure the &#8220;defines&#8221; setting in the c_cpp_properties.json file to define preprocessor symbols.<\/p>\n<p>Now if I save the change in the json file and switch back to the previous header file, the types are now resolved and the red squiggles are gone.<\/p>\n<h3>Quick Info<\/h3>\n<p>Quick Info enables viewing the type information or function\u2019s signature when hovering the mouse cursor over a variable or a function. In this extension, this used to be performed by the tag parser, which provides quick but fuzzy results \u2013 sometimes inaccurate. With the new IntelliSense engine, we can provide more accurate results for local and global variables, functions, and symbols. In the following screenshot, hovering over the local variable \u201cit\u201d displays its accurate type information.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/5-quick-info.png\"><img decoding=\"async\" width=\"877\" height=\"423\" class=\"alignnone size-large wp-image-15535\" alt=\"5-quick-info\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/5-quick-info.png\" \/><\/a><\/p>\n<h2>Go to Declaration<\/h2>\n<p>With this extension, you can already perform \u201cGo to Definition\u201d (F12) on variables or functions to open the document where the object is defined. This update added \u201cGo to Declaration\u201d (Ctrl+F12) for navigating to the file where the object is declared. To use this feature, simply right click on any variable or function and select \u201cGo to Declaration\u201d from the menu.<\/p>\n<p>In this example in the following screenshot, I selected \u201cText.DrawString\u201d function and clicked on \u201cGo to Declaration\u201d.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/6-go-to-declaration.png\"><img decoding=\"async\" width=\"704\" height=\"546\" class=\"alignnone size-large wp-image-15545\" alt=\"6-go-to-declaration\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/6-go-to-declaration.png\" \/><\/a><\/p>\n<p>In the next screenshot, you can see that the \u201cTextRenderer.h\u201d file is open and the two DrawString function declarations are being highlighted.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/7-show-declaration.png\"><img decoding=\"async\" width=\"879\" height=\"468\" class=\"alignnone size-large wp-image-15555\" alt=\"7-show-declaration\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/7-show-declaration-1024x545.png\" \/><\/a><\/p>\n<h2>Bash on Windows debugging support<\/h2>\n<p>With the release of Windows 10 Creators Update, you are now able to use VSCode and this extension to debug your Windows Subsystem for Linux (WSL) <a href=\"https:\/\/msdn.microsoft.com\/en-us\/commandline\/wsl\/about\">Bash on Ubuntu<\/a> projects. You can use VSCode to write code on Windows, and debug through bash.exe to the Bash on Windows layer. Please see these <a href=\"https:\/\/github.com\/Microsoft\/vscode-cpptools\/blob\/master\/Documentation\/Debugger\/gdb\/Windows%20Subsystem%20for%20Linux.md\">instructions on how to use VSCode C\/C++ extension to debug Windows 10\u2019s Subsystem for Linux<\/a>.<\/p>\n<h2>Tell us what you think<\/h2>\n<p><a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-vscode.cpptools\">Download the C\/C++ extension for Visual Studio Code<\/a>, try it out and let us know what you think. File <a href=\"https:\/\/github.com\/Microsoft\/vscode-cpptools\">issues and suggestions on GitHub<\/a>. If you haven\u2019t already provided us feedback, please take this <a href=\"https:\/\/www.surveymonkey.com\/r\/X6ZSTP5\">quick survey<\/a> to help shape this extension for your needs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Earlier today we shipped the April 2017 update to the C\/C++ extension for Visual Studio Code. We are excited to introduce the following new features in this update: Error Squiggles Quick Info Go to Declaration Bash on Windows debugging support The original blog post has been updated with these changes. If you have this extension [&hellip;]<\/p>\n","protected":false},"author":269,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[270,275],"tags":[274,276],"class_list":["post-15485","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-announcement","category-visual-studio-code","tag-c-extension","tag-vscode"],"acf":[],"blog_post_summary":"<p>Earlier today we shipped the April 2017 update to the C\/C++ extension for Visual Studio Code. We are excited to introduce the following new features in this update: Error Squiggles Quick Info Go to Declaration Bash on Windows debugging support The original blog post has been updated with these changes. If you have this extension [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/15485","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\/269"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=15485"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/15485\/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=15485"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=15485"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=15485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}