Adding color to bracket pairs
When dealing with deeply nested brackets in Visual Studio, it can be hard to figure out which brackets match and which do not. For people with color blindness or other optic maladies, the problem can be even worse. By color-coding bracket pairs, we’re making this much easier.
Various IDE’s and editors offer this feature today – usually done through extensions. For example, the Viasfora extension for Visual Studio has provided this feature for many years. What’s interesting about all these implementations is how they all do things a bit differently. Granted, they all colorize bracket pairs, but the way they do it differs and a lot of them provide additional features and options.
So, with increased interest and multiple viable solutions, what would the right implementation look like for Visual Studio users?
Let’s do an experiment to find out.
We’re starting out with an extension to kick off the experiment. We call it Rainbow Braces and the first iteration adds basic colorization to curly brackets, square brackets, and parentheses (see image above).
It has four unique colors that it will cycle through and repeat for as many levels deep as needed. The colors work equally well for both light and dark themes and can be customized in the Fonts and Colors options page.
You can easily toggle the colorization on and off from the Edit -> Advanced top-level menu. Or use the keyboard shortcut Ctrl+Shift+9 to execute the Toggle Rainbow Braces command.
If this feature is interesting to you, please install the Rainbow Braces extensions and take it for a ride. Make sure to share any ideas and bugs on the GitHub issue tracker, and feel free to send pull requests too. The feature request ticket is a suitable place to share your comments and thoughts, so make sure to vote and comment there as well.
Do you like the idea of community experiments like this one? Let us know in the comments below.