Musings on books, technology, food, faith, adoption, and life in a family of geeks
Original: 05 Feb 2010 06:51 am by Ron
Updated: 19 Feb 2010 05:57 am

An partial screenshot of an early version of CFML within Komodo Edit, showing some of the syntax highlighting (02/2010)
Komodo-CFML is a project I’ve undertaken to develop a reasonably functional CFML language mode for ActiveState’s Komodo Edit and Komodo IDE multi-language editor environments. I’ve long thought the Komodo platform an attractive base for CFML development, givenĀ it’s availability for the three major OS’s (Mac OS X, Linux, and Windows) and it’s reasonably full feature set, particularly:
My intent is that Komodo-CFML will eventually provide all of the following:
I’m at a 0.1.1 version release as of early February 2010. I have most of the desired capabilities related to the syntax highlighting complete; I’ve been using it in one form or another as my primary CFML editor almost exclusively for the past 6 weeks or so. At present, there are several notable items from the above list, however, that are not yet implemented:
In addition, I have a bit of work (perhaps re-work) to make code folding a little smarter for CFML tags that can’t have close tags when written in non-XML style. Folding support, as it is currently written, works great if all of the code uses XML-style tag endings for empty tags, but less well if not. An example might help make this clearer; if the editor finds
<cfset variables.goo = "some string" />
it understands this is an empty tag (based on the XML-style closing) and that it shouldn’t assume the presence of a closing tag for code folding. If, however, the tag were to be written as
<cfset variables.goo = "some other string">
the editor — or more correctly, my CFML mode — assumes the presence of a matching closing tag. I’ve got huge piles of older code still in production use written in this second form, and although the CFML itself works without problem I feel strongly that the editor needs to be a little smarter in handling these tags that can’t (as opposed to don’t) have close tags and should allow for coding in either form (as both forms are considered valid by the CFML engines themselves.
One last caveat: the current implementation almost certainly will not work correctly in syntax highlighting CFML files that are exclusively CFSCRIPT without the CFSCRIPT tags, as supported by Adobe ColdFusion 9 for components written exclusively in CFSCRIPT. I might wrestle that one to the ground one day if it becomes important to me.
My plans for Komodo-CFML are something like this:
You might notice I haven’t included the desired support for highlighting known variables in defined language scopes (e.g., my “cgi.remote_Host” example) on the roadmap; this is mostly because at this time I don’t have a feel for whether anyone (other than me) cares about this and because at this point I’m not at all sure I can get there. I’ve given this a try a couple of times and have come away with implementations that mostly work but eventually break down. It’s probably one of those things I will occasionally poke at when I have a few spare cycles and if I’m successful, I will include it in some sort of interim release off the map.

File mode selection list, after installing Komodo-CFML -- note CFML is now available
Installing the CFML mode itself is as simple as downloading the .xpi file (below) and dragging it onto a running instance of Komodo. Komodo will warn you that you should only install extensions from sources you trust… if you’re up for it, select “Install” and Komodo will ask you to restart. Once restarted, Komodo should now have CFML as an available choice in the list of supported modes (as shown at right). Select “CFML” and start playing…
The next couple of things you will probably want to play with will be file associations and font/color selections for CFML files. Installing the editor extension registers only a single file assocation as a CFML type: .cfml files. Most of us will want .cfm and .cfc as additional extensions automatically treated as CFML files. Go to “File Associations” under “Preferences” and add both of these, selecting CFML as the language associated with each file type. Fonts and colors for the different CFML language tokens can be set on the “Fonts and Colors” panel, using the “Lang-Specific” tab and choosing CFML as the language. The Komodo-CFML extension has some example CFML embedded; that example will be shown there so you can see how CFML will be rendered.
The final step is to make Komodo aware of valid CFML tags. Komodo uses HTML-Tidy to do some of its HTML validation and by default, Tidy doesn’t know which CFML tags are to be considered valid; all CFML tags will be flagged as invalid and will be underlined with annoying squiggly red lines in the default color theme. I have pulled together a quick file defining the valid CFML tags for most of the current versions of the CFML engines (see below). Download that file, put it somewhere out of the way on your drive, and then point Komodo at it via “Preferences > Languages > HTML > Syntax Checking > Configuration File”. You can modify that file to include your own custom tags, as well, if you choose.
I’ve done all of the development of this extension using the current version of Komodo Edit (v. 5.2.x), so I’m confident that it works on that version. I’ve done a bit of testing with the extension using a recent nightly trunk build of v. 6 (still in alpha) and it works the same there, so if you’re out on the edge there, it should still be OK. I haven’t tested on earlier versions. If you are running a version earlier than 5.2, please comment with your version and experience with the extension.
Editor extension: cfml-0.1.1-ko.xpi
HTML-Tidy CFML Configuration file: tidy-cfml.config
Based on feedback from people using it, I’ve got the following items on my to-do list:
All comments and feedback — particularly if you see oddities in the highlighting of the CFML code — are welcome. Just leave a comment below.