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

3 thoughts on “Syntax Coloring Shader Files in Xamarin Studio 4

  1. Thanks a lot! Have you found a way to utilize the debugger in Xamarin Studio? AFAIK there’s no way, but I can at least hope…

  2. Well the source is available here: https://github.com/Unity-Technologies/MonoDevelop.Debugger.Soft.Unity. Whether that’s just going to work against the latest MonoDevelop code I couldn’t say. It’s certainly harder than the syntax coloring 🙂 I hope Unity will end up shipping a version of the MonoDevelop close enough to mainline that we can simply compile their plugins in future. Or better yet they could put them in the Xamarin add-in repository!

  3. Pingback: Shader Syntax Coloring Plugin in MonoDevelop Addins Repository | Julian Adams

Leave a comment