(A while ago Jaroslaw Zabiello asked a question on the komodo-discuss list that motivated me to finally write up a beginner intro to using the Komodo sdk tools for creating new Komodo language extensions. Here is my slightly edited response.)
Jaroslaw Zabiello wrote:
is there any chance for syntax colouring for Mako templates ...
This is certainly possible with Komodo's UDL (User-Defined Languages) system:
Eric also wrote up a (long) intro to writing UDL definitions a while back on his blog:
Here is how packing up the Mako UDL into a Komodo extension works. Komodo includes a SDK in its install tree. On Linux and Windows this is found at "installdir/lib/sdk", and for a Mac it's found at "komodo.app/Contents/SharedSupport/sdk". That SDK includes a koext helper tool in the /lib/sdk/bin directory:
koext a command line tool for working with Komodo extensions
Put the SDK bin dir on your PATH and you should be able to run
koext at the command line. Similar to tools like cvs or svn, these are tools with multiple sub-commands. (If running these doesn't work for you, then please let us know so we can make the environment setup more smooth. There is currently a dependency on having a Python 2.6 installation -- which we should be able to remedy if necessary.)
Start your extension source dir (with `koext startext'):
$ koext help startext ...prints instructions on using this command... $ koext startext mako_language ...follow instructions for other extension meta-data...
You should now be able to build your extension:
$ cd mako_language # cd in to source dir $ koext build
This will build an .xpi file that you can install into your Komodo. However, the extension doesn't yet do anything.
Generate stubs for defining a new language for Komodo:
$ cd mako_language $ koext help startlang ... $ koext startlang Mako --ext .mako --is-html-based
This will generate a few files that you'll then need to fill out with appropriate information for Mako template files. Namely:
udl/mako-mainlex.udl The lexing/syntax-coloring UDL definition for Mako. components/koMako_UDL_Language.py The PyXPCOM component that defines the language for Komodo.
Properly filling these out is a big topic beyond the scope of this document. Your best references are:
ko*_UDL_Language.pyfiles in your Komodo installation, as many of the languages supported in Komodo are based on UDL and work in the exactly same way as the Mako language component. Look for PHP, RHTML, Smarty, HTML, TemplateToolkit, and Mason. They should be quite similar.
Note: Komodo also has a project template "Project > New Project from Template > Komodo Extension" that you could use for starting an extension, however this template does not include any language (koext) facilities.
I realize that this isn't quite as smooth a process as it could be yet, but with the help of the Komodo users, we hope to get there in subsequent releases.