Thu 21 Feb 2008
As an open source editor, komodo editor is targeted at dynamic programming language editing, which supports javascript, php, python and perl, among others.
One of the features for those supported dynamic languages is auto-generation of a list of available functions defined in a script. However, when editing dojo based javascript files, komodo can not pick up any classes declared using dojo.declare and it does not support dojo.extend either.
As it is open source, so I can have a look at the code briefly to find out where that is handled. It turns out to be a python script (to be pricise, it is KOMODO_INSTALL_DIR\lib\mozilla\python\komodo\codeintel2\lang_javascript.py). There are some YUI special handling in it to support yahoo.extend and yahoo.lang.extend. After some trail and failure, I managed to change that to support dojo.declare and dojo.extend pretty well.
For those impatient, you can download the modified lang_javascript.py and replace the file in your installation (this is for komodo editor 4.2.x or IDE 4.2.x, not sure whether it works for previous versions of komodo). After restarting your komodo, classes declared using dojo.declare should be recognized and shown in the object browser tab. Autocompletion should also work for these classes, as well as additions to a function inplanted using dojo.extend.
Although komodo has a plugin framework just as firefox, I can see no way to add logics to the functions defined in the file lang_javascript.py. If anyone knows how, I may try to convert this to a plugin of komodo. The modification is also available in diff format.
If you want to add dojo API support to komodo, try the dojo extension.
As a side note: the modified lang_javascript.py does not keep the original YUI support any more.
Edit on 22/2/2008: a cleaner patch is submitted to komodo bugzilla. It is cleaner than the patch linked here and fixes several issues. However, that is against the latest revision of that file, rather than the one shipped with komodo editor/IDE 4.2.x.
RSS feed for comments on this post. TrackBack this post