Visual Studio Code C/C++ extension October 2017 update

Rong Lu

点这里看中文版

Yesterday we shipped the October 2017 update of the Visual Studio Code C/C++ extension. Following the lightbulb suggestions for IntelliSense include path feature that was shipped last month, we’re adding another feature to make IntelliSense setup easier – support for the compile_commands.json file, eliminating the need for manually configuring includes and defines. In addition, this update also introduces new UI to indicate IntelliSense parsing status.

Compile_commands.json to supply includes and defines information for IntelliSense

The compile_commands.json file is a compilation database that consists of an array of  “command objects”, where each command object specifies one way a translation unit is compiled in the project. Its format is specified in the Clang documentation and can be auto-generated by many build systems, including CMake and Ninja. When the IntelliSense engine is set to “Default”, it will first read includes and defines from the compile_commands.json file to power IntelliSense if the file is specified in the “compileCommands” property in the c_cpp_properties.json file.

If parsing fails, the IntelliSense engine will then fall back to use the include paths from the “includePath” property and defines from the “defines” property in the c_cpp_properties.json file.

Try out the compiler-based IntelliSense

Note that the compile_commands.json file support is only available if you have turned on the new compiler-based engine. By doing so you will get improved, more accurate results for several IntelliSense features, including auto-complete suggestions for class/struct/namespace members, quick info tooltips, error squiggles, reference highlighting, and parameter hints. Turn on the new IntelliSense by changing the “C_Cpp.intelliSenseEngine” setting in your settings.json file (open from menu File->Preferences->Settings) from “Tag Parser” to “Default”.

IntelliSense status indicator

In the right corner of the status bar, you will find two icons indicating the parsing status of the IntelliSense engines – the red flame icon for the compiler-based IntelliSense engine and the white database icon to show where the Tag Parser is in parsing files. Hover over the database icon to see a tooltip that shows the number of files that are already parsed and the total number of files to be parsed.

Tell us what you think

Download the C/C++ extension for Visual Studio Code, try it out and let us know what you think. File issues and suggestions on GitHub. Provide us feedback in this quick survey to help shape this extension for your needs. You can also find us on Twitter (@VisualC).

0 comments

Discussion is closed.

Feedback usabilla icon