IntelliSense and Code Formatting Settings
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.
You can tell which IntelliSense engine is presently active by locating to “Go” button on the top source file bar:
The button will only be present when using Clang IntelliSense and will not be shown otherwise.
Switching IntelliSense Engines
You can switch between the Clang IntelliSense and the regular VC++ IntelliSense via VisualGDB Project Properties -> IntelliSense:You can observe the global state of the engine and turn it on/off globally via View->Clang IntelliSense Status:
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):Advanced CMake, Arduino, Mbed and ESP-IDF projects only support Clang-based IntelliSense.
Formatting Settings
Starting from VisualGDB 5.4, VisualGDB supports the clang-format formatting engine. It is recommended for all new projects and can be fine-tuned by clicking the “Format” button in the top source bar:
If the “Format” button is not shown, the currently open file is not handled by Clang-format and its formatting can be configured via Tools->Options->Text Editor->C/C++ (VisualGDB)->Formatting.
You can switch between clang-format and the legacy formatting engine via the IntelliSense Settings page of VisualGDB Project Properties:If you are using clang-format, VisualGDB will format your code based on the settings in a .clang-format file determined as follows:
- If a project has the “Use a custom .clang-format file” setting enabled in VisualGDB Project Properties -> IntelliSense Settings, the format file specified there will be used.
- If not, VisualGDB will search every parent directory (up to the root directory, such as c:\) of each opened file for .clang-format 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.
- If no .clang-format files were found, VisualGDB will use the %LOCALAPPDATA%\VisualGDB\.clang-format file that contains basic settings derived from the regular VS settings (advanced formatting settings are not auto-translated and must be specified manually).
VisualGDB includes a convenient interactive editor for the .clang-format files. Simply open a .clang-format file via the File->Open command, or click the “Format” button in the upper right corner of your source file, and VisualGDB will open the corresponding .clang-format file in the interactive editor:If you prefer editing the .clang-format files manually, you can find a detailed reference on their format here: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
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.
CodeJumps
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:
You can also use the “Settings” button in the CodeJumps popups to customize various CodeJumps settings.