Visual Studio Code C/C++ extension: May 2019 Update
The May 2019 update of the Visual Studio Code C/C++ extension is now available to C/C++ extension Insiders version 0.23.0. This release includes many new features – Visual Studio Code Remote Development extensions with the C/C++ extension, an IntelliSense Configurations settings editor UI, and IntelliSense improvements. For a full list of this release’s improvements, check out our release notes on GitHub.
You can join the C/C++ extension Insiders program by changing your C_Cpp: Update Channel setting to “Insiders.”
Visual Studio Code Remote Development with the C/C++ extension
Remote Development with Visual Studio Code is now available, and you can use it with the C/C++ extension!
Visual Studio Code Remote Development allows you to use a container, remote machine, or the Windows Subsystem for Linux (WSL) as a full-featured development environment. Visual Studio Code can provide a local-quality development experience including full IntelliSense, debugging, and code editing regardless of where your code is hosted. In fact, you don’t need any source code on your local machine to use this capability.
With Visual Studio Code Remote Development extensions you can:
- Easily develop your C/C++ programs on the same operating system you are deploying to
- Sandbox your development environment
- Use runtimes not available on your local OS
- Access an existing environment from multiple locations
- Debug an application running somewhere else.
Setting up Visual Studio Code Remote Development
You can install the public preview of the Remote Development extension pack in Visual Studio Code Insiders from the extension marketplace.
More details on getting started with the extensions can be found in the Visual Studio Code Remote Development getting started section. You will see a few new components when you install the Remote Development pack:
Using Visual Studio Code Remote Development with the C/C++ extension
Once you are set up with a Visual Studio Code Remote Development extension, install the C/C++ extension for the Remote Development extension you wish to use. For example, with WSL:
The extension will provide local-quality C/C++ IntelliSense, debugging, and code browsing for the remote environment you’re developing for. In the above case, I now have access to the Linux version of the C/C++ extension.
Keep in mind, you may need to change your compiler path, tasks, or launch.json based on the environment you are remotely targeting. You can follow our GCC on the Windows Subsystem for Linux tutorial for more details on setting up WSL with the C/C++ extension.
IntelliSense Configuration settings editor UI
Users of the C/C++ extension have consistently told us that configuring IntelliSense is difficult, especially editing the c_cpp_properties.json file correctly. To address this pain point, we created a UI editor to help you more easily configure basic IntelliSense settings. The IntelliSense Configuration settings editor UI:
- makes IntelliSense configuration easier to understand
- provides a simple and clear interface for the most basic settings to get IntelliSense working
- validates inputs such as missing paths
- offers an alternative to editing JSON files (but, you’ll always be able to edit JSON directly if you’d like)
Here is a screenshot of the IntelliSense Configuration settings editor UI:
You can get to the IntelliSense Configuration settings editor UI through the command palette (Ctrl+Shift+P) via the “C/C++: Edit configurations (UI)” command. There are additional entry points including quick fix IntelliSense error links.
Please Note: When you select “Configure” for the first time to configure IntelliSense, VS Code will open the UI editor or JSON file based on your workbench.settings.editor setting. If workbench.settings.editor is set to “ui”, then the UI editor will open by default, and if it is set to “json”, then the JSON file will open by default. You can view that setting under VS Code preferences → settings → “Workbench Settings Editor”.
We made a variety of IntelliSense improvements in the May 2019 update.
We now validate that the specified compilerPath and intelliSenseMode values match for a better IntelliSense configuration experience in c_cpp_properties.json and the IntelliSense Configurations UI.
The IntelliSense engine fallback setting now defaults to disabled, so the IntelliSense engine will no longer automatically switch to the Tag Parser for translation units containing an #include error.
The disabled value for error squiggles no longer shows missing header squiggles.
We now only show (by default) error squiggles if include headers are successfully resolved.
Tell Us What You Think
Download the C/C++ extension for Visual Studio Code, give it a try, and let us know what you think. If you run into any issues, or have any suggestions, please report them on the Issues section of our GitHub repository. Set the C_CppProperties.UpdateChannel in your Visual Studio Code settings to “Insiders” to get early builds of our extension.