Having recently joined the Komodo team, I’ve been given the opportunity to write about my experience so far in contributing to Komodo and getting familiar with its code base.
My first task was creating an integrated, background spell checker for the upcoming Komodo IDE 9.2. This new checker is slated to replace the IDE’s existing and antiquated dialog-based one.
Prior to joining the Komodo team, I did a lot of work with the Scintilla editing component, which is what Komodo uses internally for editing files. Scintilla provides developers with an API for manipulating and displaying text. However, this API is written in C and C++. I say “however” because Komodo is developed on the Mozilla platform, which makes heavy use of web technologies, particularly JavaScript. In fact, Komodo’s primary means of extension involves JavaScript. Therefore, in order to start my task, I needed to find a way to communicate with Scintilla via JavaScript.
One part of Komodo under active development is a JavaScript SDK for users. This SDK provides users with a set of JS modules that can be used to define new commands, add custom menu items, and much more. In fact, the SDK had exactly what I was looking for: the ko/editor module. The editor module provides a small, user-friendly subset of Scintilla’s capabilities: retrieving text, moving the caret, and performing simple actions like cut, copy, and paste. However, this subset was not enough for me — I needed access to Scintilla’s raw API in order to leverage my expertise. Then I found it:


require('ko/editor').scimoz()

This one line of code gave me unprecedented access to Scintilla’s raw power. From here on out it was a simple matter of determining what text is displayed in the window, which regions of text were eligible for spell checking, iterating over each word and invoking Mozilla’s built-in spell checking engine, and finally marking up misspelled words.
With half the task complete, I was headed into the unknown. Interacting with Scintilla is my bread and butter, whereas interacting with a Mozilla-based application using JavaScript is a whole different ballgame. Fortunately, Komodo’s SDK came to my rescue once again. I was able to utilize the ko/menu and ko/dom modules to modify the default context menu on-the-fly to include spelling suggestions. I was able to employ the ko/commands module to register a command for displaying said suggestions via key shortcut. I was able to use the ko/logging module to help me find and explain the numerous bugs I experienced as I felt my way around the system.
All in all I learned a lot in developing this new feature for Komodo IDE. I will not say it was easy, nor can I say it was straightforward, but Komodo certainly has the proper foundation for a new developer like me to make a concrete contribution in a relatively short amount of time.