TextMate Flex tips
I’ve started working with Flex, and since I use TextMate I have written some useful commands which I thought I would share.
I started by using Daniel Parnell’s Flex bundle, because of the language syntax, which I didn’t want to write myself.
To use these, I suggest that you first install Daniel’s bundle. Then you create a new command, paste in the code below and set the other properties (Save, Input, Output, etc.). Perhaps one day this will be a bundle of its own, but not today.
Build with Ant
This command lets you use the standard TextMate key sequence for building, command-B to compile your current project with Ant. Since I work with Flash 8 projects too, I didn’t want to use this for ActionScript files, so it only works for MXML for now (it’s simple to change that, just add source.actionscript to the scope selector property).
!/bin/sh
ant -find build.xml | perl -pe 's/\n/
/'
Save: All Files in Project
Input: None
Output: Show as HTML
Activation: Key Equivalent command-B
Scope Selector: source.mxml
What it does is that it tells ant to search for a file called build.xml in the current directory (the directory in which the current file resides) and if it doesn’t find it to continue searching in the parent directory, and so on. When the build file is found Ant will run the default target and show the results in a new window. The Perl magick is to translate newlines to break-tags, since the output window renders the text as HTML.
Lint
Lint is another word for syntax checking, and since there is an XML syntax checker installed with OS X, why not hook it up to check the current MXML document when it is saved?
With this command you will get a message if your MXML-file isn’t valid XML when you save it. This saves you from having to wait for the compiler to tell you that you have forgotten to close you tags.
!/bin/sh
xmllint --noout - && echo "XML syntax OK" Save: Current File Input: Entire Document Output: Show as Tool Tip Activation: Key Equivalent command-S Scope Selector: source.mxml You will see a tool tip saying “XML syntax OK” when you save MXML files, or an error message which tells you what is wrong.
![]()
2007-03-28 at 07:05
[...] just did a search and found some ‘Textmate Flex Tips‘ that extend the Flex [...]
2007-10-15 at 14:14
[...] been a while since I wrote about TextMate and Flex, but still my last post is one of the first five when I google for “textmate flex“, “textmate flex [...]