Komodo Edit is extremely customisable, and the xJSFL extension adds new functionality that makes it easier to than ever to develop great JSFL (special thanks to David Wagner for his contribution to getting the Python component up and running!) :
The Extension comes in two flavours, the Basic extension, which features include:
And the Pro extension, which also includes:
- Advanced publishing shortcuts
- Abbreviations, which let you quickly insert code snippets by entering their name
- A JSFL debugger, which allows you to step through errors in your code
To install the basic extension:
- Make sure Komodo Edit is open
- Browse to your xJSFL/core/assets/install/Komodo/ folder, or download from GitHub
- Drag the extension onto Komodo Edit
- Restart Komodo Edit
Upon restarting, you should open Komodo's preferences panel via Edit > Preferences, and then:
- Go to xJSFL and set the path to your xJSFL installation folder
- Ensure the Publishing Shortcut checkboxes are checked, assuming you want to map these default keys to the publishing commands
- Go to Code Intelligence > API Catalogs and make sure the JSFL entry is checked
You may need to restart Komodo again for the publishing shortcuts to become active.
Basic Extension features
The extension provides full JSFL auto-complete for the entire CS4 JS API, including typed values from function returns, as you can see below. This auto-completion will work for all properties (excluding Array elements) and functions:
Basic Publishing shortcuts
The xJSFL extension comes with standard keyboard shortcuts that provide 4 quick ways to run your JSFL scripts:
Run File (CTRL+Enter)
Saves and executes the current file. Depending on the file extension (and sometimes content) the following will happen:
- *. jsfl - the file will run in Flash
- *.xul, *.xml - if the file starts with <dialog> the XUL dialog will be previewed in Flash, fields validated, and values output when OK is clicked or Enter is pressed
Pro Extension features
The Pro extension adds some more advanced features to the basic extension that makes it easier to develop larger or more complex scripts, as well as some tools to make everyday JSFL development that much speedier.
Please note that the Pro extension is not yet available, but will be available for download for a small fee, shortly (price yet to be decided).
Advanced publishing shortcuts
Debug File (ALT+Enter)
Attempts to debug the current file, as well as any subsequent files being loaded by that file.
Traditionally, Flash returns misleading errors when it encounters invalid code in loaded files, but xJSFL attempts to run external code via xjsfl.file.debug(), and if it traps errors, the problem file will be opened in Komodo at the offending line.
See the Debugger section for more info.
Run Project (CTRL+SHIFT+Enter)
Saves all files, then executes the file in the left-most tab.
This allows you to work on a series of files such as libraries, but publish another, such as an initialization or module bootstrap file. Just make sure the initialization file is in the left-most tab.
Run Script on Selected Library Items (Ctrl+Alt+Shift+Return)
Saves the script, then opens Flash and executes the script in the timeline of each of the selected Library Items.
This is useful when you have a library of similar items that need updating, as you can practice your script with just one item, then once perfected, run the script and update the other items in one go.
Abbreviations are a standard Komodo feature that allow you to enter a single keyword in the editor pane, then expand that keyword into an editable code, with placeholder regions that you tab through to fill in values. It's perhaps easier illustrated with a sequence of images:
Firstly, type a keyword corresponding to an abbreviation name, in this case "for":
Then, press CTRL+T (or tab, if you have the AutoCode Extension installed) to trigger the abbreviation's template:
The template is inserted into the document, and the first placeholder is highlighted in each place in the template that it is used. You can alter it by simply typing, or accept the value and tab to the next placeholder. Here, we tab from "i" to "item" and type "element". Each placeholder in the template is updated simultaneously:
Finally, press tab one more time to finish and leave the caret in the next logical place to add code:
The xJSFL extension comes with built-in abbreviations and full templates for both JSFL and XUL:
- Control structures: do, for, foreach, forin, if, switch, try, while
- Functions and classes: func, class, subclass, meth, namespace
- Comments: com, doc
- xJSFL: init, inspect, module
- Layout: dialog, grid, hbox, vbox, separator, spacer, element
- Controls: button, checkbox, choosefile, colorchip, expression, flash, label, script, targetlist, textbox
- Compound Controls: listbox, listitem, menulist, menuitem, popupslider, property, radiogroup, radio
You can also add your own abbreviations in the Komodo Toolbox by creating a new named Snippet, and making sure it's in a folder called Abbreviations/JSFL/ (Komodo picks the correct abbreviation for the language - if you want it for all languages, place it in Abbreviations/General/)
The Pro extension also comes with a JSFL debugger, that attempts to trap errors generated in Flash, pass them to Komodo, and pop up a dialog that you may use to step through the offending lines of code.