Visual Studio Code C/C++ extension Nov 2017 update – Multi-root workspaces support is here!
This week has been very exciting for the Visual Studio Code C/C++ extension! It crossed 4 million downloads earlier this week only 18 months after its first release! Today, we are shipping the November 2017 update, which enables the extension to work with multi-root workspaces seamlessly, making VS Code an even more powerful C/C++ development environment.
Multi-root workspaces support
VS Code 1.18 and later provides multi-root workspaces support, which allows users to work with multiple project folders in VS Code. This can be very useful when you are working on several related projects at the same time. With the November update, the C/C++ extension now provides C/C++ IntelliSense, code browsing, and debugging support for each opened folder independently. Follow the instructions in the VS Code Multi-root Workspaces document to add folders to your workspace. The screenshot below shows two folders opened in VS Code, each has its own c_cpp_properies.json file defined:
The IntelliSense engine retrieves include paths and defines information from the c_cpp_properties.json file located in the .vscode folder in each opened folder to provide all the IntelliSense and code browsing features, including member list, parameter hints, go to definition, etc. Each folder operates independently from other folders.
For example, in the screenshot below, I have two Calculator.cpp files opened in VS Code, one from the “Calculator” folder and the other one from the “Fancy Calculator” folder. Each file has a Calculator class defined, but with different functions. After typing “c.”, the member list pops up in each file shows the expected member functions that match the definition of the class that lives in the current context (i.e. the folder that the editing document belongs to).
Compiler-based IntelliSense is the new default
By now you may have noticed an improved out-of-box IntelliSense experience. 😊 The compiler-based IntelliSense engine is now the default engine to provide better and more accurate results to some of the key IntelliSense features, including auto-complete suggestions for class/struct/namespace members, quick info tooltips, error squiggles, reference highlighting, and parameter hints. If you are curious, this blog post talks about how it works and how to control the behavior.
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).