Productivity Improvements for C++: New Default Colorization, Template Argument Filtering in Call Stack Window, and IntelliCode On-By-Default
New Default Semantic Colorization
In Visual Studio 2019 version 16.3 Preview 2 we’ve introduced a new default semantic colorization scheme for C++. For a long time, many of the default colors were simply black. However, colorization can help you quickly understand the structure of code at a glance. To take advantage of this, we’ve created two new color schemes, and of course you can still customize your colors further by typing “Change font” in the Ctrl + Q search bar.
Under Tools > Options > Text Editor > C++ > View > Color Scheme you can now pick between three presets: Enhanced, Enhanced (Globals vs. Members), and Visual Studio 2017. By default, Enhanced will already be selected. Note that these color schemes change the Default color values, so if you have previously customized a color, you’ll need to reset it to Default if you want the new scheme to take effect (see the “Customizing Individual Colors” section at the bottom of this post).
This is the new default color scheme. The following colors of this colorization differ from Visual Studio 2017:
- Local variables
- Escape characters
- Keyword – control
- This is a new classification for keywords related to control flow (if, else, for, return)
- String escape characters
Below are of the Enhanced color scheme for the Light and Dark themes.
Enhanced (Globals vs. Members) Scheme
We also added a preset called “Enhanced (Globals vs. Members)” which is designed to emphasize the scope of your code. In this scheme, global functions and global variables share the same color, while member functions and fields share another color.
For example, notice how “pow” now stands out as a global function.
Visual Studio 2017 Scheme
If you’d like to revert to the Visual Studio 2017 scheme, select the “Visual Studio 2017” preset.
Customizing Individual Colors
We understand that colorization preferences are personal, so if you wish to customize any particular color, you can do so under Tools > Options > Environment > Fonts and Colors.
To use all the default colors, make sure to click “Use Defaults” in the top right.
Template Argument Filtering in Call Stack Window
Previously, when using heavily to moderately templated types (including the STL), the Call Stack window quickly would become overwhelmed with template expansions to the point that became difficult to debug due to poor readability.
Now, you can right-click in the Call Stack Window and toggle “Show Template Arguments” to make room for other important information, and making it much more readable!
In Visual Studio 2019 version 16.2 we added C++ IntelliCode in-box. In version 16.3 Preview 2, we are taking that a step further and have turned the feature on-by-default. This means that, by default, you’ll start to benefit from autocompletion results recommended by a machine-learned prediction model. The recommended results are surfaced at the top of the completion list and are prepended with stars:
For more details on IntelliCode, check out our other C++ IntelliCode blog posts.
Talk to Us!
If you have feedback on any of these productivity features in Visual Studio, we would love to hear from you. We can be reached via the comments below or via email (email@example.com). If you encounter other problems with Visual Studio or MSVC or have a suggestion, you can use the Report a Problem tool in Visual Studio or head over to Visual Studio Developer Community. You can also find us on Twitter @VisualC and follow me @nickuhlenhuth.
After VS6.0, VS2002, VS2003, VS2006, VS2008, VS2010, VS2015, VS2017, VS2019, there is no Italic options under Tools > Options > Environment > Fonts and Colors. Hey, Bold has been there since VS6.0 however.
What is the real technical reason for not implementing Italics in the code editor?
Edit: Sorry, my fault, Bold has been added after VS6.0
If I recall correctly, somewhere around VS2012 there was a brief introduction of italics and maybe underscore, but they were pulled before final release.
Strikeout could also be useful (eg, deprecated or disabled code).
“Strikeout could also be useful (eg, deprecated or disabled code)”
Right, very good.
Id’ use italics for comments.
I feel there is a need to follow (and implement) cosmetics details instead of considering VS a professional tool used day by day by professionals. In my honest opinion.
I would like to see an option to filter a text in output window. It would help to see for example only required information. Also an option to highlight a given text would be also useful.
“Enhanced” colorization is available in version 16.3.0 Preview 2.0. But the option “Color Scheme” under “Tools > Options > Text Editor > C++ > View” is missing. So it is not possible to change to “Enhanced (Globals vs. Members) Scheme”
The way an extension provides default colors for a theme to VS is via some registry values that specified the colors for a particular theme (https://docs.microsoft.com/en-us/visualstudio/extensibility/internals/vsix-color-compiler?view=vs-2019). The “color schemes” concept is just various sets of colors that the C++ team provides for each known theme and instead of providing one set like before, there’s now three sets that can be swapped in via changing the option.
So, if you are using a custom theme, there is no way to know about what that is because it’s arbitrary and unknown at the time the schemes were created and therefore the “Color Scheme” option is hidden because changing it wouldn’t make any visible difference to the colors since it would be changing the colors only for themes that aren’t currently active.
Of course, using the theme editor extension you can edit the colors in a custom theme to match what we chose in the various schemes if they seem like a good fit with the custom theme.
While we are at it can we get at least some Call Stack Colorization?Colours from different .dlls will be awesome for example. Whatever. That white wall of text is awful.
Adjusting the code highlighting is difficult as of 16.2. In the color settings I am missing a preview where you could see the changes in real time. There should be some default snippet of code which you could edit. Now to see the changes you must click OK, check in the editor and then return back to Settings for another round of adjustments.
Agree. I DO need an Apply button.
Colorization is important not only in the text editor but everywhere else code appears. You have recently added color in tooltip which is great. Please consider adding syntax color in (by priority):
– Auto-completion listbox
– Goto listbox
– All find references / results window
– Output window: for compilation errors it would greatly improve readability