Smart Code Coloring with CoCo

This post has been republished via RSS; it originally appeared at: Channel 9.

Remember the days when we had the choice of one color, usually White or Green, for our code (cause we were using a DOS)? And that first time you saw syntax coloring and how your brain exploded?

Yeah, I don't either (um... yeah...)

Today color is all over our coding windows or IDE's. But, in many cases, it's not really "smart" coloring. It's simple, this is a data type, this is a variable, this is the start/end of an enclosure, etc.

What would be cool is a way to use the smarts in the .NET Compiler Platform (fka as Roslyn) to intelligently color your code...

I guess that makes George Aleksandria's project officially cool!

CoCo

An open source extension that uses Roslyn to color and decorate our C# code.

A Visual Studio 2017 extension that uses Roslyn API's for analyzing C# source code and colorize appropriate syntax nodes to different colors. It makes easily recognizabling the supported elements.

Extension supports following elements:

  • Namespaces
  • Alias for namespaces
  • Fields in the local scope
  • Parameters
  • Instance methods and constructor
  • Static and extension methods
  • Events
  • Properties
  • Instance fields
  • Enum fields

Use Visual Studio Fonts and Colors options to change colors for items. Look for items in Display Items that starts with CoCo format:

If you are looking the same extension for Visual Studio 2015 you can get it from here.

Examples

In the Dark theme:                     

image

In the Light/Blue theme:

... Click through to download it ...

And has George said, it's open source, https://github.com/GeorgeAlexandria/CoCo



Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.