What is it?
VSColorOutput can change the color of a line emitted to the output window based on specified rules. The rules consist of regular expressions. Rules map to classifications which in turn map to colors.
Download and open the VsColorOutput.visx file. VSColorOutput only supports Visual Studio 2010. To uninstall, go the Tools|Extensions
page, find VSColorOutput in the "Installed Extensions" and click uninstall. Registry entries are not removed so later installations will reuse these settings.
How does it work?
VSColorOutput hooks into the the classifier chain of Visual Studio. This allows VSColorOutput to monitor every line sent to the output window. A list of classifiers, consisting of regular expressions and classifications is checked. The first matching expression determines the classification the line of text. If no patterns match, then line is classified as BuildText
From here, Visual Studio does the heavy lifting of mapping the classification to a color. Colors are stored in the registry.
I originally wrote VSColorOutput to highlight trace output while debugging. It's still the primary reason I use it. I discovered it also highlighted lines in the build window as well. I found this made it much easier to visually parse the output and quickly locate items of interest.
Colors are set in the Tools|Options|Fonts and Colors|Text Editor
dialog. VSColorOutput colors start with "VSColor" so they group together in the list and are easy to locate. Logically, it makes sense to add these to the "Output" category of the "Fonts and Colors" dialog but, interestingly, Visual Studio does not support adding colors to this category.
There are nine VSColors classifications. They are:
- Build Text
- Build Header
- Log Information
- Log Warning
- Log Error
- Log Custom1
- Log Custom2
- Log Custom3
- Log Custom4
The names reflected their intended use but are entirely arbitrary.Build Text
is the default classification for any line that does not match the other patterns. It's default color is "Gray". I've found this helps to highlight the other classified lines.
dialog contains just one item. If you open it you'll see list of patterns and classifications. The regular expressions use the .NET form (http://msdn.microsoft.com/en-us/library/hs600312.aspx
At run-time, VSColorOutput will walk this list in order, testing the line of text against the regular expression. If it matches, the line is given the classification associated with the pattern. No additional patterns are tested for the given line. Therefore, the order of the classifiers is significant.