How to Colour Code Tabs by Regex in Visual Studio 2022

February 28th 2023 Microsoft released Visual Studio 2022 Version 17.5.1.

This release included the ability to colour code tabs using RegEx’s.

The problem was, THEY didn’t tell anyone how.

In the Visual Studio Developer community we have been asking for the ability to colour code tabs in Visual Studio for a long time.

When VS2022 was released, Microsoft included the ability to colour code tabs, however they only included the ability to colour code tabs by project. So if you mainly work within one project this feature was essentially useless – you could choose a colour for your tabs, but all the tabs would be the same colour.

Later the ability to colour code by file extension was added, again this wasn’t much use as most of your files will all be *.cs files, or *.vb or *.cpp etc… And therefore all the same colour.

So when Microsoft said they had included the ability to colour code tabs based on Regex in VS 17.5.1 it was time to get excited. That is until you fire up Visual Studio 2022, enable colour coding tabs by RegEx and then realise there is no way to actually configure the RegEx’s.

…or so it seems.

I don’t know what kind of problems Microsoft engineering are facing at the moment, I don’t work there and don’t have any access to their inner workings. But they definitely appear to be either underfunded, understaffed or both. They seem to always work on doing the bare minimum when implementing a new feature as is the case with tab colour coding.

By contrast look at the quality of work that is being done by lone wolf extension developers such as Context Keeper and Tab Studio, often their implementations far exceed the quality and scope of equivalents from Microsoft.

It is frustrating to see Microsoft call another feature “done” when in reality they have done the bare minimum of work and left the developers to struggle with a half-baked implementation.

Tab colour by RegEx is a classic example of this shabby approach to engineering (take a look at the screenshot below).

To be able to configure the RegEx’s used for tab colour coding you need to know to click the gear icon in the Document Well which reveals a menu option to Configure Regular Expressions.

Clicking this opens a text file containing the RegEx‘s.

Here you can create RegEx’s to define groups of document file paths that will all share the same colour.

When you then set the colour of a tab in Visual Studio, that colour will apply to all tabs whose file paths match that RegEx.

While this is a great improvement on only being able to colour code tabs based on which project they are in, or by their file extension, it’s still a very crude and basic way of enabling developers to customise their workspaces.

So for now I will be sticking with Tab Studio to handle colour coding of my tabs in VS, and if Microsoft ever decide to implement a full featured alternative then I might consider switching to the native implementation.

Until then my money is with Tab Studio.

SHARE

Leave a Comment

You might also enjoy

Support RadBoogie

Buy Me a Beer