C++ Brace Pair Colorization and More in Visual Studio

Mryam Girmay

Visual Studio 17.5 brings you several new improvements in the C++ editing experience. Now we are excited to announce that C++ Brace Pair Colorization, Spell Checker, All-In-One Search, Reimagined Member List, and Macro Expansion Improvements are released in the Visual Studio Preview.  

These features are also part of our focus on increasing game development productivity. Look out for a dedicated post coming soon. To start using the features, make sure to update to the latest version of Visual Studio Preview.  

Brace Pair Colorization for C++

You can now visually distinguish each set of opening and closing braces for your C++ code making it easier to see your code’s scope or find any missing braces. There will be different colors for curly braces, and the paired braces {} will have the same color, which will make it easy to visualize where the braces open and close especially when you have intensely nested codes. The feature is available for C++ today and will be coming to additional languages in subsequent releases. 

C++ Brace Pair Colorization example

Brace Pair Colorization will be on by default, and you can find it by going to Tools > Options > Environment > Preview Features > Enable Brace Pair Colorization (requires restart) or by searching for “Enable Brace“.

Setting for enabling or disabling Brace Pair Colorization

Spell Checker 

Visual Studio now has a Spell Checker that helps in making your spelling accurate. When you misspell words, this feature will make sure to mark them so that you can check them out, and then suggested spellings will appear. This feature checks the spelling of all words inside comments, and names on declarations will be checked by separating camelCase and underscored words. To bring quick action, you can either click on the light bulb or press “Ctrl+.” or “Alt+Enter. There will be three options on the context menu; to choose from the suggested spellings, to ignore the spelling issue, and to disable the spell checker. With the ignore action, you will add words to your personal dictionary. 

Spell Checker example

The Spell Checker will be on by default, and the setting is located on Tools > Options > Environment > Preview Features > Text spell checker. This feature can also turn on/off by selecting Edit > Advanced > Toggle Text Spell Checker or from the main toolbar in Visual Studio as displayed in the screenshot above. 

Image spell check setting

The Visual Studio Spell Checker Preview has in-depth details on how this feature works and how to configure Spell Checker using .editorconfig. 

The new All-In-One Search makes searching easier by combining the code and feature search in the same UI. This is important because finding where to search can be challenging sometimes, especially when there are more ways to search. 

Image all in one search example

The feature will be disabled by default, and it can be enabled by checking in Tools > Options > Environment > Preview Features > New Visual Studio Search Experience (requires restart). This will be gradually enabled by default in the near future. 

Setting for enabling or disabling All-In-One Search

When you enable and restart Visual Studio, a new search icon will appear on the menu bar. The search will have Code Search (Ctrl+T) and Feature Search (Ctrl+Q) in it. Code Search will be more useful to find types, files, and members, while Feature Search will prioritize Visual Studio’s tools, templates, options, and components.    

The new search looks like

The New: Better search in Visual Studio has full information on this feature and the ability to preview and edit your code in the search window. 

This video is a short demo on how the new all-in-one search works: 

C++ Reimagined Member List  

This feature will be gradually rolled out in the next Previews, so at first, only a subset of customers from those who have updated the latest Preview will see the Reimagined Member List. Reimagined Member List promotes the matching type items on the top of the member list so that customers can find member lists they look for faster. This is similar to the Predictive IntelliSense (experimental feature) Visual Studio already provides, which displays only the filtered matched types in the member list. However, Reimagined Member List is improved in the way that it brings up the matched items to the top of the unfiltered member list, making all items still available.  

We will be exploring this space further in future releases, evaluating more criteria for promoting items to the top of the list. We want to thank our Unreal Engine developers for giving us valuable feedback.

Reimagined Member List example

When you have enabled IntelliCode along with this feature, they will be ordered respectively at the top of the unfiltered alphabetically ordered member list. There will be a max of ten slots for IntelliCode and Reimagined Member List combined. They all will have star icons in front of them, however, the member list tooltip that appears when you hover over the list will inform you if the list is from IntelliCode or Reimagined Member List.

Member list tooltip displaying IntelliCode

Macro expansion improvements 

When you hover over a macro, the expanded macro gets displayed inside Quick Info. Macro expansion inside quick info will now have a formatted display and monospaced font, which makes them more appealing and easier to read. Another valuable piece of feedback we heard from our Unreal Engine developers has been on the difficulty of working with Unreal Engine macros, which can be notoriously long. We have built this feature to address this issue.

The macro expansion Quick Info will include “Copy” and “Expand Inline” links. The copy link allows users to copy the expanded macro to the clipboard, which you can paste anywhere you want including putting it as a comment in the IDE. Therefore, you can use the copied/pasted macro expansion as a reference, when you want to check out what the macro expands to without hovering over the macro. This also can be useful when you want to compare two expanded macros.

Macro Copy in action

The “Expand Inline” link replaces the macro in the editor with its full expansion. This feature is useful in cases where nested macros have long expansions, and you wanted to check what’s going on in each step. Expanding it inline will display the whole expansion in the editor and comparing the expansion of two or more macros can be performed without switching to a different file.

Macro Expand In Line In Action

Please Share your Feedback 

We hope these features will uplift your productivity with your coding. Please let us know what you think in the comments below or in the Developer Community so we can improve the experience. 



Discussion is closed. Login to edit/delete existing comments.

  • TheKaangok 6

    Just updated my Visual Studio to 17.5. Brace pair colorization is not enabled by default (C++), and cannot find that option in preferences page. That feature seems to be non existent on my instance.

Feedback usabilla icon