{"id":5849,"date":"2020-03-31T09:30:41","date_gmt":"2020-03-31T16:30:41","guid":{"rendered":"https:\/\/visualgdb.com\/w\/?p=5849"},"modified":"2021-04-13T17:21:41","modified_gmt":"2021-04-14T00:21:41","slug":"intellisense-and-code-formatting-settings","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/documentation\/intellisense\/","title":{"rendered":"IntelliSense and Code Formatting Settings"},"content":{"rendered":"<p>VisualGDB includes its own Clang-based IntelliSense engine. It is specifically optimized to work with gcc-based embedded and Linux code and works better with Linux projects. VisualGDB can also use the regular VC++ IntelliSense engine, however it will be less precise and will often miss Linux-specific language constructs.<\/p>\n<p>You can tell which IntelliSense engine is presently active by locating to &#8220;Go&#8221; button on the top source file bar:<\/p>\n<p><a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/03\/sense.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5850\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/03\/sense.png\" alt=\"\" width=\"655\" height=\"166\" \/><\/a>The button will only be present when using Clang IntelliSense and will not be shown otherwise.<\/p>\n<h2><a id=\"engines\"><\/a>Switching IntelliSense Engines<\/h2>\n<p>You can switch between the Clang IntelliSense and the regular VC++ IntelliSense via VisualGDB Project Properties -&gt; IntelliSense:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/03\/onoff.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5851\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/03\/onoff.png\" alt=\"\" width=\"692\" height=\"258\" \/><\/a>You can observe the global state of the engine and turn it on\/off globally via <strong>View-&gt;Clang IntelliSense Status<\/strong>:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/03\/engine.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5906\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/03\/engine.png\" alt=\"\" width=\"824\" height=\"266\" \/><\/a><\/p>\n<p>Note that the regular VC++ IntelliSense will only work for VC++-based project types (the ones that have the Visual C++ Icon in Solution Explorer):<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/03\/icon.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5852\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/03\/icon.png\" alt=\"\" width=\"334\" height=\"290\" \/><\/a>Advanced CMake, Arduino, Mbed and ESP-IDF projects only support Clang-based IntelliSense.<\/p>\n<h2><a id=\"formatting\"><\/a>Formatting Settings<\/h2>\n<p>Starting from VisualGDB 5.4, VisualGDB supports the <strong>clang-format<\/strong> formatting engine. It is recommended for all new projects and can be fine-tuned by clicking the &#8220;Format&#8221; button in the top source bar:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/03\/clangformat.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5853\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/03\/clangformat.png\" alt=\"\" width=\"652\" height=\"169\" \/><\/a><\/p>\n<p>If the &#8220;Format&#8221; button is not shown, the currently open file is not handled by Clang-format and its formatting can be configured via <strong> <a href=\"https:\/\/visualgdb.com\/settings\">Tools-&gt;Options-&gt;Text Editor-&gt;C\/C++ (VisualGDB)-&gt;Formatting<\/a><\/strong>.<\/p>\n<p>You can switch between <strong>clang-format <\/strong>and the legacy formatting engine via the IntelliSense Settings page of VisualGDB Project Properties:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/03\/format.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5854\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/03\/format.png\" alt=\"\" width=\"696\" height=\"151\" \/><\/a>If you are using <strong>clang-format<\/strong>, VisualGDB will format your code based on the settings in a <strong>.clang-format<\/strong> file determined as follows:<\/p>\n<ol>\n<li>If a project has the &#8220;Use a custom .clang-format file&#8221; setting enabled in <strong>VisualGDB Project Properties -&gt; IntelliSense Settings<\/strong>, the format file specified there will be used.<\/li>\n<li>If not, VisualGDB will search every parent directory (up to the root directory, such as <strong>c:\\<\/strong>) of each opened file for <strong>.clang-format<\/strong> files. Once the file is found, it will be used to control the formatting of that source file. This allows using different formatting settings for different file groups in your project.<\/li>\n<li>If no <strong>.clang-format<\/strong> files were found, VisualGDB will use the <strong>%LOCALAPPDATA%\\VisualGDB\\.clang-format<\/strong> file that contains basic settings derived from the regular VS settings (advanced formatting settings are not auto-translated and must be specified manually).<\/li>\n<\/ol>\n<p>VisualGDB includes a convenient interactive editor for the <strong>.clang-format<\/strong> files. Simply open a <strong>.clang-format<\/strong> file via the <strong>File-&gt;Open<\/strong> command, or click the &#8220;Format&#8221; button in the upper right corner of your source file, and VisualGDB will open the corresponding <strong>.clang-format<\/strong> file in the interactive editor:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/03\/clang.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5862\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/03\/clang.png\" alt=\"\" width=\"1313\" height=\"813\" \/><\/a>If you prefer editing the <strong>.clang-format<\/strong> files manually, you can find a detailed reference on their format here: <a href=\"https:\/\/clang.llvm.org\/docs\/ClangFormatStyleOptions.html\">https:\/\/clang.llvm.org\/docs\/ClangFormatStyleOptions.html<\/a><\/p>\n<p>Warning: clang-format it slower than the legacy Sysprogs Formatting Engine. If you are working with large source files and automatic formatting (or newline indentation) works too slowly, please consider switching to the legacy formatting engine.<\/p>\n<h2><a id=\"codejumps\"><\/a>CodeJumps<\/h2>\n<p>CodeJumps are interactive annotations shown for functions, types, variables and other code entities. They are only supported when using Clang IntelliSense and can be temporarily suspended via the button in the top right corner of the source file editor:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/03\/codejumps.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5855\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/03\/codejumps.png\" alt=\"\" width=\"659\" height=\"334\" \/><\/a><\/p>\n<div id=\"main\" class=\"clearfix\">\n<div class=\"inner-wrap clearfix\">\n<div id=\"content\">\n<div class=\"article_content\">\n<p>You can also use the &#8220;Settings&#8221; button in the CodeJumps popups to customize various CodeJumps settings.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>VisualGDB includes its own Clang-based IntelliSense engine. It is specifically optimized to work with gcc-based embedded and Linux code and<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[199],"tags":[],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/5849"}],"collection":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/comments?post=5849"}],"version-history":[{"count":8,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/5849\/revisions"}],"predecessor-version":[{"id":7281,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/5849\/revisions\/7281"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=5849"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=5849"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=5849"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}