Shader Syntax Coloring Plugin in MonoDevelop Addins Repository

Xamarin 5.0 provided the impetus to finally put the shader coloring plugin into the live Xamarin Studio Addin Repository. This will host and build versions of the plugin for both Xamarin Studio 4.x and Xamarin Studio 5.x. An added benefit is you can search, download and install the plugins within the Add-in Manager in MonoDevelop. The steps to do this in Xamarin Studio are simple:

  1. open the Add-in Manager from the menus
  2. on the Add-in Manager Update tab hit ‘Refresh’
  3. on the Add-in Manager Gallery tab search for ‘mime’
  4. install “Unity Mimetypes”
Advertisements

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