News

Semantic Colorization Heads What's New for C/C++ in Visual Studio Code

Semantic colorization was singled out by Microsoft for new functionality added to the July 2019 update of the C/C++ extension for Visual Studio Code.

The much-requested semantic colorization -- colorization of tokens even when they are out of context, thus providing colorization beyond that of syntax -- may not sound like a big deal, but it was fairly complicated to enact.

"We faced many challenges in creating support for semantic colorization for the C/C++ extension since there is no VS Code API for semantic source highlighting and no support for semantic colorization in the VS Code language server protocol," said the dev team's Tara Raj. "We also can’t access a theme’s colors programmatically, so this support was even more challenging to make possible.

"Luckily, we were able to devise a way to overcome these challenges by managing our own set of tokens and their ranges, using TextEditorDecorations, and directly parsing theme files and VS Code settings to determine which colors to apply. With that, we are excited to share semantic colorization support!"

A practical example of what semantic colorization means was provided, illustrating how a struct named "box" was color-highlighted in its definition and also when it's used in the main function.

Another highlight of the July update is improved configuration of IntelliSense via a new settings editor UI. "The interface is simple and clear, and thus makes IntelliSense configuration easier to understand," Raj said.

Finally, Raj detailed tweaking the default path for the IntelliSense cache that was introduced in the March update -- caching header information for faster IntelliSense -- and improved in response to developer feedback that it was caching too much data.

More information on the above and other changes in the July update to the C/C++ VS Code extension is available in the July 24 blog post and the GitHub release notes.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube