Introduction to building a Komodo extension

Posted by trentm on 2007-09-06 15:16

Update: A lot of this information has been superceded by

(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 "". 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.)

  1. 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...
  2. 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.

  3. 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:

        The lexing/syntax-coloring UDL definition for Mako.
        The PyXPCOM component that defines the language for

Properly filling these out is a big topic beyond the scope of this document. Your best references are:

  • The UDL reference in the Komodo documentation.
  • Eric's blog post for UDL.
  • Check out the example Maya extension, which uses UDL:
  • A Komodo macro that can visually show styling information
  • Example .udl files in the Komodo source and sdk directory (lib/sdk/udl/...)
  • Look at other ko* files 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.

ActiveState Staff
Thu, 2010-01-07 20:14

Note: You can use this Komodo helper macro to visualize the document styling:


pyrokinesis | Mon, 2010-02-22 01:49

This has been really great thanks for all your efforts.
I would like to take this a few steps further, but i'm not exactly sure how. Here is the functionality I would like to add...
When typing the parenthesis we get tool tips, but they are empty...
Support the available flags for each command, example..., dag=True, exactType=True)

Generate tips and auto-complete options for all of the flags.
Also the option to show tips when auto complete pops up.

Can anyone advise on how we might proceed with this functionality for both Mel and Python?

Thank you very much.

ActiveState Staff
Mon, 2010-02-22 17:11

You'd need to edit the Maya API catalog file maya.cix that resides in the Maya extension:

updating the "signature" and "doc" attributes in the XML file should give you what you need.

BTW, the CIX schema is available here as the "cix-2.0.rng" attachment:


sergiol | Sun, 2010-10-10 05:10

These paths are not correct or do not reflect the current version.
We have and now in the bin subdirectory as python scripts.

So it is needed to do python or do you know sthg more straight to call those scripts?

ActiveState Staff
Tue, 2010-10-12 21:33

You should be able to run koext directly (it resides in the sdk/bin directory) - as long as it's on your system PATH. I.e.:

/opt/Komodo-IDE-6/lib/sdk/bin/koext help