The Visual Studio Code C/C++ extension has had over one million downloads in the past two months! We are very happy to see so much interest in the most popular C++ extension for Visual Studio Code. Even more exciting for us last week was the release of the September 2017 update, which brings in many new features to the extension:
- Lightbulb now provides include path suggestions for IntelliSense
- Parameter hints are now powered by the compiler-based IntelliSense engine
- Reference highlighting
- macOS Framework support for IntelliSense
Lightbulb include path suggestions for IntelliSense
Setting up the include path for IntelliSense just got easier. When you open a folder, the extension will recursively search for potential include paths that match the header files your code is using based on the paths set by the browse.path setting in c_cpp_properties.json, and give you suggestions to help you set up the include path. Click on the green squiggles under #include statements and a lightbulb will appear and offer suggestions of paths that will allow IntelliSense to resolve the included file.
Parameter hints are now powered by the compiler-based IntelliSense engine
When the IntelliSense engine is set to “Default”, you will now start to see parameter hints only for the functions that match the type of which the function is invoked. Hints will also be presented for template arguments. Previously, the extension returned hints for all functions with a matching name, regardless of type.
Reference highlighting
Reference highlighting is now supported. When the IntelliSense engine is set to “Default”, moving the text cursor over a symbol in the editor will highlight the matching symbols in the same file. When the IntelliSense engine is set to “Tag Parser”, all exact word matches will be highlighted. You can use the editor.occurrencesHighlight setting (File->Preferences) to turn on/off this feature. Selecting a range of text will continue to invoke VS Code’s editor.selectionHighlight behavior.
macOS Framework support for IntelliSense
The extension now provides built-in support for macOS frameworks to be the sources of include files for IntelliSense. We added a new property called “macFrameworkPath”, which is auto-added to your c_cpp_properties.json file when the file is first created. Use C/Cpp: Edit Configurations… command to create the c_cpp_properties.json file if it doesn’t already exist. Then simply putting the macOS framework paths in the macFrameworkPath property or adding the paths to the includePath property to enable the IntelliSense engine to search for include files under those paths.
Use macFrameworkPath property:
Use includePath property:
Tell us what you think
We encourage everyone to try out the new IntelliSense and send us feedback. 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”.
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).