How to enable C# syntax highlighting for other file extensions.

joolsajoolsa GBMember ✭✭
edited March 2013 in Visual Studio

Hi -

I've got .shader and .cginc files in my project, which get no syntax coloring. (Yup, I'm using Xamarin Studio with Unity.) I'd like to enable C# syntax coloring for these file extensions (as you can do in Visual Studio), but can't find a way. Is there a way to do this?

Thanks,

Jools

Posts

  • mhutchmhutch USMember, Xamarin Team Xamurai

    You would need to write an extension to set a mimetype for these files.

    Note - we actually have a cg syntax mode would would be more appropriate than C#... also, I think the old Unity addins or fork of MonoDevelop (on Unity's github) have some syntax highlighting definitions you could take.

  • joolsajoolsa GBMember ✭✭

    Thanks! I'll take a look at those links, and would consider writing a plugin. I've done it in the past, but the docs are a bit thin and this seems like something that should have a UI, like in Visual Studio :)

  • mhutchmhutch USMember, Xamarin Team Xamurai

    Although Unity does not appear to be actively maintaining/developing their version of MonoDevelop nor contributing upstream, they have published source for their addins - the Debugger integration, and the Boo and UnityScript addins.

    An interested Unity user could port these addins to MonoDevelop 4.0 (i.e. Xamarin Studio), improve them, and publish them on the official addin build server. Unity has also published their MonoDevelop 2.8.2 fork so any worthwhile patches from that could be extracted and submitted upstream as pull requests.

  • joolsajoolsa GBMember ✭✭
    edited March 2013

    Cheers for the links.

  • joolsajoolsa GBMember ✭✭
    edited March 2013

    Here's a really basic add-in to set the mimetype on .shader and .cginc files: https://github.com/jools-adams/monodevelop-unity-mimetypes. Works for me (TM)! I'm not sure if there's any point to publishing it in the addin build server. I did have one question regarding the build system. I simply created a project in Xamarin Studio, but I had to add a reference to the DLLs in the Xamarain Studio install directory. That relative reference is likely broken for everyone else. What's the best way of setting up the path?

  • mhutchmhutch USMember, Xamarin Team Xamurai
    edited April 2013

    The reference is resolved at runtime by the addin engine, as long as your addin depends on the addin that provides that dll in its <Dependencies> section - and it looks like it does :)

  • joolsajoolsa GBMember ✭✭

    I've put the shader colorization plugin on addins.monodevelop.com:

    http://addins.monodevelop.com/Project/Index/126

    and also a similar plugin to enable colorization of .java files:

    http://addins.monodevelop.com/Project/Index/127

    They are both marked as pending. How long does it take to get these approved?

Sign In or Register to comment.