{"id":19695,"date":"2018-06-26T14:27:59","date_gmt":"2018-06-26T21:27:59","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vcblog\/?p=19695"},"modified":"2019-02-18T17:47:52","modified_gmt":"2019-02-18T17:47:52","slug":"new-experimental-code-analysis-features-in-visual-studio-2017-15-8-preview-3","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/new-experimental-code-analysis-features-in-visual-studio-2017-15-8-preview-3\/","title":{"rendered":"New, experimental code analysis features in Visual Studio 2017 15.8 Preview 3"},"content":{"rendered":"<p>The Visual C++ team has been working to refresh our code analysis experience inside Visual Studio. We\u2019re aiming to make these tools both more useful and natural to use and hope that they\u2019ll benefit you no matter your workflow, style, or project type.<\/p>\n<h4>Trying out new features<\/h4>\n<p>In Visual Studio 2017 version 15.8 Preview 3, available in the <span><a href=\"https:\/\/visualstudio.microsoft.com\/vs\/preview\/\">Preview channel<\/a><\/span>, we\u2019ve introduced some new, in-progress code analysis features. These features are disabled by default, but you may enable them under Tools &gt; Options &gt; Text Editor &gt; C++ &gt; Experimental &gt; Code Analysis. We encourage you to test them out and provide any feedback or comments you may have regarding your experience.<\/p>\n<h4>Background analysis<\/h4>\n<p>After enabling the features, code analysis will now run in the background when C++ files are opened or saved! Our goal here is to bring code analysis warnings into the editing experience so that bugs can be fixed earlier, and defects aren\u2019t discovered only during build time. Once background code analysis runs for a file, warnings will be shown in the Error List and in the editor as squiggles.<\/p>\n<h4>In-editor warnings<\/h4>\n<p>Along with background analysis, code analysis warnings now display in-editor as green squiggles underneath the corresponding source code. In this Preview, if you change the file to fix a warning, the squiggles aren\u2019t automatically refreshed. If the file is saved or analysis is re-run for the current file (Ctrl+Shift+Alt+F7), the squiggles and the Error List will be updated. We\u2019re hoping these visual indicators will prove useful by giving you the ability to see code warnings in the same place you write and edit it.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/15_8_p3_VSBlog_CppCA.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/15_8_p3_VSBlog_CppCA-446x350.png\" alt=\"\" width=\"400\" height=\"314\" class=\"alignnone wp-image-19705\" \/><\/a><\/p>\n<h4>Error List<\/h4>\n<p>Code analysis warnings will continue to be displayed in the Error List, but we\u2019re trying to improve this experience as well. Filtering in the error list should be faster. We encourage using the \u201cCurrent Document\u201d filter to see only the errors for the files being edited. This pairs nicely with the background analysis feature. Warning details are also displayed in-line in the Error List instead of in a separate pop-up window. We\u2019re believe having the details near the error makes it easier to dig into warnings. The new Error List experience is still a work in progress, so let us know of there are any \u201cmust have\u201d features we should consider.<\/p>\n<h4>Future work<\/h4>\n<p>We\u2019re excited to show off a preview of what\u2019s to come, but for now there are a few known issues you may encounter. First, only the \u201cRecommended Native Rules\u201d ruleset is used when background analysis is run. Second, not all project types are supported with background analysis. You can always try running code analysis through the menus to force squiggles to refresh. Finally, the best way to clear squiggles for a project is to \u201cClean\u201d build or disable the experimental feature.<\/p>\n<p>Along with improved background analysis runs, highlighting for multi-line warnings, and a change to squiggles to show when warnings are out-of-date, automatic fix-its are also on the way. These IntelliSense-like lightbulb menus will give you the ability to rapidly correct or make changes to your code \u2013 and see exactly what will be changed \u2013 directly in the editor.<\/p>\n<h4>Send us feedback<\/h4>\n<p>Thank you to everyone who helps make Visual Studio a better experience for all. Your feedback is critical in ensuring we can deliver the best code analysis experience, so please let us know how <span><a href=\"https:\/\/visualstudio.microsoft.com\/vs\/preview\/\">Visual Studio 2017 version 15.8 Preview 3<\/a><\/span> is working for you in the comments below.\u00a0General issues can be reported from within Visual Studio via\u00a0<span><a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/how-to-report-a-problem-with-visual-studio-2017\">Report a Problem<\/a><\/span>, and you can provide any suggestions through <span><a href=\"https:\/\/visualstudio.uservoice.com\/forums\/121579-visual-studio-2015\/category\/30937-languages-c\">UserVoice<\/a><\/span>. You can also find us on Twitter (<span><a href=\"https:\/\/twitter.com\/visualc\">@VisualC<\/a><\/span>).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Visual C++ team has been working to refresh our code analysis experience inside Visual Studio. We\u2019re aiming to make these tools both more useful and natural to use and hope that they\u2019ll benefit you no matter your workflow, style, or project type. Trying out new features In Visual Studio 2017 version 15.8 Preview 3, [&hellip;]<\/p>\n","protected":false},"author":1079,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[270,1,256],"tags":[],"class_list":["post-19695","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-announcement","category-cplusplus","category-experimental"],"acf":[],"blog_post_summary":"<p>The Visual C++ team has been working to refresh our code analysis experience inside Visual Studio. We\u2019re aiming to make these tools both more useful and natural to use and hope that they\u2019ll benefit you no matter your workflow, style, or project type. Trying out new features In Visual Studio 2017 version 15.8 Preview 3, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/19695","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\/1079"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=19695"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/19695\/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=19695"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=19695"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=19695"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}