2 min

Tags in this article

, ,

The new Rainbow Braces extension helps code “make sense”, according to its developer.

Microsoft’s C# principal product manager Mads Kristensen developed an extension for Visual Studio called ‘Rainbow Braces’. The new extension displays opening and closing curly brackets, parentheses and square brackets in matching colours. According to website DevClass, the extension helps identify the scope of a particular pair.

“Rainbow Braces makes it easier to make sense of nested code”, Kristensen himself tweeted. The product manager added that the extension was developed in response to a feature request.

Bracket Pair Colorization, a highly similar feature, was built into Visual Studio Code 1.60 a year ago. “I regularly use both Visual Studio Code and Visual Studio 2019/2022 and I would love to have this feature available in Visual Studio”, the request said.

Not yet an official add-on

The extension was published under Kristensen’s name instead of being listed as an official Microsoft add-on. In the case of Visual Studio Code, converting the feature from an extension to a core part of the editor produced enormous performance improvements, Microsoft claimed at the time.

The feature may seem insignificant, but it can help developers save a lot of time when reviewing code and trying to work out exactly where an extra or missing curly brace is breaking compilation. It can also help prevent errors, such as having a statement outside a for loop when it should be within, or vice versa.

It’s the kind of feature which experienced developers do not want to be without, DevClass says. This is particularly true for curly brace languages such as C, C#, JavaScript and TypeScript, they say.

Playing catch-up with Visual Studio Code

Although Visual Studio retains some unique advantages for Windows development, it’s become common for the “comprehensive IDE” to play catch-up with features that are already present in Visual Studio Code. Another advantage of the open-source editor is that it runs pretty much the same on all platforms, whereas Visual Studio is very different on a Mac and won’t run on Linux at all.