August 22nd, 2017

Visual Studio Code C/C++ extension August 2017 Update

Rong Lu
Principal Product Manager

Last week we shipped the August 2017 update to the Visual Studio Code C/C++ extension. Besides several bug fixes, this update includes a new command for resetting the IntelliSense database file and continued improvements to the new compiler-based IntelliSense engine. Thanks to everyone who provided us feedback on the new IntelliSense engine in the past couple months!

“Reset IntelliSense Database” command

The extension ships the “Tag Parser”, which is used to provide quick, but “fuzzy” results for some of the IntelliSense features. It is also used as the fallback solution for the other IntelliSense features powered by the new compiler-based IntelliSense engine, such as quick info tooltips, error squiggles, and auto-complete for class/struct/namespace members. The Tag Parser builds up a database of symbols from your source files, and stores the database file (.BROWSE.VC.DB) on disk for every folder that you have opened in VS Code.

However, the Tag Parser currently doesn’t automatically delete symbols from the database when the paths that the symbols are located in are removed from the browse.path setting. With the extraneous symbol information left in the database, some of the IntelliSense and code browsing features may provide inaccurate results. For example, “Go to definition” might take you to an irrelevant symbol. We are working on getting the database to always match the symbols referenced by the browse.path setting, but in the meantime, if you run into such a situation, one way to recover is to clean up the database file and allow it to re-build from scratch. In this update, we added a new command “Reset IntelliSense Database”, which finds the database file on disk, deletes it, and then re-builds a new one. You can access the command via the Command Palette as shown in the following screenshot.

Please note that the command currently resets the database file only for the first folder opened in VS Code. If you’re using a VS Code Insiders build, which allows you to open multiple folders in VS Code, the command doesn’t clean up any subsequently-opened folders. We’ll be adding support for multiple folders in a future update.

New IntelliSense experience

The new IntelliSense experience first shipped as the default for VS Code Insiders back in April, and it has been greatly improved based on the feedback we received over the past couple months (thanks to everyone who sent us feedback!). Now we feel like it’s a good time to gradually roll it out as the default to more users. The new IntelliSense engine is the same engine that has been powering the C++ IntelliSense and code browsing features in Visual Studio for many years. For VS Code, so far we’ve implemented several IntelliSense features with the new engine, including auto-complete suggestions for class/struct/namespace members, quick info tooltips, and error squiggles (linting). These features now provide improved, more accurate results than the tag-based IntelliSense. You can check which IntelliSense engine is being used by looking at the value of the “C_Cpp.intelliSenseEngine” setting in your settings.json file (open from menu File->Preferences->Settings). Changing the value to “Default” will provide you the new, improved IntelliSense experience. We encourage everyone to try it out and let us know what you think. Your feedback will help us shape the experience as we implement more features using the new IntelliSense engine going forward.

The extension enables the new IntelliSense experience by first trying to fully parse any opened file using the new IntelliSense engine. If it discovers that it cannot find a header file or a dependency, it will fall back to the tag parser and provide the original fuzzy IntelliSense behavior. This blog post Visual Studio Code C/C++ extension June 2017 Update details how the fallback behavior works and how you can control it.

Tell us what you think

We encourage everyone to try out the new IntelliSense and send us feedback. 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. If you haven’t already provided us feedback, please take this quick survey to help shape this extension for your needs.

Author

Rong Lu
Principal Product Manager

Rong Lu is a Principal Program Manager at Microsoft working on Python data science tools in Visual Studio Code and Azure.

0 comments

Discussion are closed.