- Developer Tools
Eric Promislow, November 22, 2010
The new toolbox in Komodo 6 (available in Komodo IDE and Komodo Edit) has addressed several concerns we and many of our customers have had over the years. This screencast introduces some of the changes and new features, and the post goes into a bit more detail.
Ease of Sharing
First, we wanted to make it easier to share tools. To do this, we had to free tools from the project system.
Now each tool is a standalone file with a .komodotool extension, and toolbox hierarchies are simply managed by the filesystem.
Previous versions of Komodo were limited to importing Komodo package files (those *.kpz files). This turned out to be a bit of an impediment to creating a public gallery of tools, as each tool needed to be wrapped as a package. Komodo 6 can import tools more directly, with your choice of importing either a .komodotool file, a folder of tools, a standard zip file, or a version-5-style .kpz package.
You can use the context menus in the new toolbox, or simply drag and drop a link or icon representing a .komodotool file onto the target folder in the toolbox. We plan on upgrading sites like ActiveState Code and ActiveState Community to take advantage of the new structure.
Ease of Finding Things
This is one of the main reasons for using an IDE, right? So you don't have to maintain a mental map of where everything is while you're focusing on your code. We want the same to apply to tools.
The first step was to amalgamate the toolboxes. The standard toolbox and shared toolbox (Komodo IDE) are now displayed in one sidebar. Additionally, each loaded extension and active project can contribute a toolbox. So now if you're looking for a tool that has a particular name, you don't need to remember which toolbox it's a member of. Just go to the toolbox sidebar, and type any part of the tool's name to find it. And while we've kept the filter view on tools from v5, we've added something new...
Launching Tools Made Easier
If you've been using Fast Open for quickly finding files, you might be wondering why there isn't something similar for finding tools. There is now — you'll find it in the "Invoke Tool" dialog in the Tools menu (Shift+Ctrl+K on Linux and Windows, Shift+Cmd+K on OSX). The screenshot below shows it at work.
Drilling Down: Using the Tools Database
Over the years, I've often wanted to search the toolbox, but not by the name of the tool. Either I've wanted to know which macro contained a certain term, or I've wanted to know which macros were triggering on which events.
Since each tool is now a separate file, you can simply use Komodo's Find in Files utility (or `grep -r`, if you prefer) to search the toolbox directories for a pattern. Since each tool corresponds to a single file, you no longer have to wade through the dense XML of a KPF file looking for a particular string, or trying to figure out the context. It's true that JSON files do some encoding, but it's minimal. Each line of a macro is stored as a single newline-free string (newlines are added when the JSON file is loaded, so they adapt to the platform), and only quotes, backslashes, and non-ASCII characters are escaped.
What if you want to search for some other aspect of a tool? We haven't provided any UI for doing that (yet), but Komodo 6 stores all the info on its loaded tools in a Sqlite3 database (as a sort of persistent cache). The database is in your profile area, in the toolbox.sqlite file, and you can perform queries on it. Using a tool like the Komodo IDE 6 Database Explorer makes this particularly easy. For example, this query will show which loaded macros can be triggered by various events:
select cd.name, cd.path_id as "id", m.trigger from common_details as cd, macro as m where cd.path_id = m.path_id and m.trigger_enabled
...and this query will show you which macros have an event listener, which could be firing periodically:
select cd.name from common_details as cd, common_tool_details as ctd where cd.type = 'macro' and cd.path_id = ctd.path_id and ctd.value like "%addEventListener%"
A Note on Directory Shortcuts
There's been a long-running bug that directory shortcuts couldn't be modified — you were stuck with whatever path you assigned them at creation-time. I also noticed that they could easily be generated by running a macro. So in Komodo 6, we've dropped the "New Directory Shortcut" toolbox command, but added a "Create Directory Shortcut" in the "Sample Macros" folder. The cool thing about this macro is that you can look at its source as a straightforward example of using the toolbox API in v6, including changing a tool's icon on the fly.
What to Expect
Adding new tools to Komodo should be as easy as sending a file repository a get command, and pulling down a set of tools into a target folder. By freeing tools from their former .kpf home, it should be easier to maintain larger macros with SCC tools. These tools are all plain JSON files, which means while it's easiest to use Komodo to maintain the files, they can be edited by any text editor, or even run through automatic filters, or, as the new Directory Shortcuts show, generated automatically.
With these changes, we hope to see an explosion of cool macros, snippets and abbreviations.
Trackback URL for this post:
Share this post: