Syntax Coloring Shader Files in Xamarin Studio 4

Since Xamarin released the renamed MonoDevelop 4 as Xamarin Studio I’ve been using it alongside Unity 3D for all my development. It’s definitively better than the Unity-bundled version of MonoDevelop (2.8 with Unity’s patches) for C# development on a Mac. I think I’ve found my new favorite IDE – a title that MonoDevelop has previously never quite taken. There’s still a few rough edges though. The ones I care about most are Unity related. The Unity debugging plugins are missing, but I can live with that for a while. Unfortunately syntax coloring isn’t enabled for shader files, at least those with .shader and .cginc extensions. It’s amazing how hard code becomes to write when syntax coloring isn’t present!

Shader Code Fades to Black And White

Thanks to some helpful feedback on the Xamarin forums it’s clear that all the parts are there, but those file extensions need to have their mime type correctly for CG shaders. That requires writing a add-in, although it only needs to contain an XML file which gets compiled into a dll. Michael Hutchinson pointed me at the getting started documentation for add-ins. Add a dash of effort and out pops https://github.com/jools-adams/monodevelop-unity-mimetypes. Just compile it and drop the dll here (on Mac):

~/Library/Application Support/XamarinStudio-4.0/LocalInstall/Addins
Advertisement