Visual Studio: regex custom code highlighting

Since my application supports some paranoid level of debugging (every data destination, every step in the code is written to the destination of the log), my code is littered with messages about registration in some methods, for example.

logger.Log(LogLevel.Debug, 0, "Initializing i18n..."); Lang.Language = SystemInfo.Language; Logger.Log(LogLevel.Debug, 0, "Default system language: " + Lang.Language); string[] languageFiles = Directory.GetFiles(ClientEnvironment.LanguagePath); Logger.Log(LogLevel.Debug, 0, "Initializing local language files..."); 

As you can see, there are only two β€œreal” lines of code. This makes the code somewhat difficult to read. I wonder if I can specify a custom code formatting rule rule in Visual Studio so that the log lines are displayed in soft gray text instead of the default text color. This will result in implicit highlighting of the "real" code lines, which will result in more readable code.

I need something like:

 If statement starts with "logger.Log", set foreground color to gray. 

Do you know any plugins that could archive this behavior? Thank you in advance.

+4
source share
1 answer

Edit: this is not a suitable answer to a question about a poster, but I cannot delete it because StackOverflow does not allow deleting the accepted answer.

This Visual Studio extension will do exactly what you want:

You can specify regular expressions for coloring a custom output window.

0
source

All Articles