Going Git

February 24th, 2009

Git is one of the tools I’ve been meaning to try for a while now. It’s a version control systems that offers a distributed model, is fast, light and perfect for branching and merging.

I was pretty confident I’d be up and running quickly with git as I’m used to subversion. But given the past few days experience I wouldn’t say it’s been easy. It may have been, but I decided my way in would be to mirror both the Flex and ActionScript 3 TextMate Bundles over on github – which meant using git svn. In principle it looked straightforward, but after a few clumsy maneuvers I was quickly disorientated (mainly because git svn dcommit happens to rebase on the quiet). I don’t think I’m out of the woods yet but am really beginning to see what all the noise over git is about. It’s well worth the initial steep learning curve.

What I’m hoping to see are forks of the bundles, new features, feedback, and maybe one or two bug fixes ;) There are some branches to try as well. One or two build solutions have been cooked up but not quite finished. Alongside a basic attempt to integrate fdb, but it still needs a UI bolting on the front to offer true integration.

Oh, and for those of you who’ve been waiting for the auto-completion alpha then that’s in the main bundle now. Take a look at the ‘Auto Complete’ command – I’ll post a little more about it soon.

The ActionScript 3 bundles had the ability to auto import a class for a long time, but the functionality has been limited to the area of the document between the package and class declarations. There have been some interesting solutions to improve this workflow, but ultimately it needed a more elegant solution.

If you grab the most recent version of the bundle you’ll now find that ⇧⌘I can be invoked from a wider scope and will present you with a list of possible classes to import based on the current word. Select one and an import statement for the class will be generated and injected into the document (or a tooltip saying the class is already imported).

I ought to stress that the importing is improved, but needs more work. The command is scoped to work within a public class, so any private classes hiding beneath your package block won’t benefit. You’re also likely, if you’re tidy, to want to organise the imports statements later on. But what is great about this is it let’s you skip a repetitive task and focus on higher level logic.

AS3 Autocompletion in TextMate

September 26th, 2008

Here’s a little teaser showing autocompletion for ActionScript 3 in action using TextMate.

It’s work in progress and I’m planning on releasing it for testing once Dialog 2 moves out of review. I also need to add the functionality to search multiple ancestors in interfaces to resolve the type of an item.

I’ve quickly put together a bundle for working with JSFL, or the Flash JavaScript API. If you’re not familiar with JSFL it is used to automate and extend the Flash IDE. The bundles language grammar relies on the JavaScript bundle being installed (which is one of TextMates default bundles) as it extends it and adds all of the JSFL objects, methods and properties. You also get:

Run (⌘R)

Runs the current document in Flash.

Documentation (⌃H)

Searches the documentation and presents a list of matches. As I only have access to machines with Flash CS3 installed I don’t know the alternative paths to the documentation previous (and later) versions of Flash use so please drop me a line and I’ll include them.

Auto Complete Method / Property (⌥⎋)

Provides a pop-up list of the available method and property completions based on the current word.

I’d recommend checking out the bundle from here for the most up to date version, otherwise you can download it as a zip here.

JSFL Bundle

Apache Bundle Upgrade

February 11th, 2008

The Apache bundle, which I originally contributed in the early days of TextMate, was due an upgrade. So I’ve made a few improvements…

Start, Stop, Restart and Graceful commands (⌘R)

These commands, which all target apachectl, are now bound to ⌘R under the source.apache-config scope which makes it more convenient to directly control httpd from TextMate.

As apachectl requires sudo privileges I used applescript for authentication. For reasons only known to Apple the password request dialog would launch but not get focus – leaving you to reach for the mouse to target the input field. Moving away from the keyboard is slow so this was something that really annoyed me. I’ve now switched to using the excellent tm_dialog system which makes things much smoother.

It is also possible to store your admin password in your Keychain, this is done by selecting the “Add to Keychain” toggle in the password request dialog box. I’m more than happy with the security implications of this as I’m fairly good at keeping my machines locked. If you do choose to do this then the command line security app will have access to the keychain item and is the only way someone could gain access.

Documentation (⌃H)

This now searches a documentation index file for the current word/selection then redirects or presents a list of matches as appropriate. If you appear to have the documentation installed locally then the script favours it over the apache website.

Open Include (⇧⌘D)

The language definition has been improved to add a scope for Includes. Using the key combination apple-shift-D on this scope opens the file referenced by the inlcude, or directory if it is wild carded.

Open Config… (⇧⌘C)

Previously there were various commands to open the apache.conf files these have now been consolidated into one command which searches the apache install directory, either /etc/apache2 or /private/etc/httpd depending on your version of OS X and the /users, /extra and /other subdirectories. All the conf files found are presented in pop-up from which one can be choosen to open.

Bundle Configuration

It is now possible to override the default bundle behaviour by setting the following environmental variables. TM_APACHE_DIRECTORY, TM_APACHE_ACCESS_LOG, TM_APACHE_ERROR_LOG and
TM_APACHE_MANUAL_URI all allow the custom targeting of files and directories. See the bundle help for a detailed explanation.

Open Bundle as Project…

January 2nd, 2008

I’m often opening the bundles I develop – and nosing through the others – as projects, and doing so via the Finder or the File > Open menu is long winded. To speed up the process here’s a small command which searches the default bundle locations and presents all the bundles in a dialog. Pick the one you’re interested in and TextMate opens it as a project. That’s if it’s enabled, when it’s not the default behavior is to enable it, second time round it will open as a project.

Download

HelvectorLight Theme

December 23rd, 2007

I’ve just updated the ActionScript 3 Bundle to include an ASDoc language definition. This is essentially a scope change of Luke Daley’s JavaDoc language definition. The result is that the following scopes within the documentation blocks are brought under new colour jurisdictions.

keyword.other
entity.name.tag
punctuation.definition.tag

For me, using my favourite theme – Twilight – the extra colour where I was so used to seeing grey wasn’t working. To combat it, and get things greyscale again, I added 3 new theme elements and applied them to the following scopes:

comment.block.documentation keyword.other
comment.block.documentation entity.name.tag
comment.block.documentation punctuation.definition.tag

The results are the HelvectorLight.tmTheme which calms things down again.

Download

I share one of my development machines with another flash developer and have run into a problem whereby the debug flash player was only available to the user who installed it. Trying to set more generous permissions on the plug-in didn’t work. So I simply changed the name of the plug-in by prefixing it with the installing users name then reinstalled it as second user. This leaves you with multiple instances of the flash player in Library/Internet Plug-Ins but as each user only has permission to use the player they installed no confusion arises.

The most recent debug player can be found here. An archive of debug players can be found here.

TextMate Ant Bundle

October 30th, 2007

Following on from my work with the Apache, ActionScript, ActionScript 3 and Flex TextMate Bundles, comes a bundle for the Ant build system. It is available for checkout here which I’d recommend for the most up to date version, or download as a zip here.

Ant Bundle

As a Flash developer who’s been working with Flex and ActionScript 3 since late last year I found I couldn’t settle down and use the Flex Builder Eclipse plug-in. Previously I had acquired the habit of editing ActionScript using TextMate and compiled using the lightning fast MTASC, and although there were alternatives (FDT, Sepy), I’ve always preferred the lightweight flexibility and crisp feel that TextMate has. As a result I’m responsible for TextMate’s ActionScript 3 and Flex bundles.

At the moment the bundles are in the review section of the TextMate Repository. Once installed the bundle help covers how to set up (primarily to download the flex sdk) and outlines the non-obvious commands.

The main highlights of the bundles are:

  • MXMLC and FCSH Build Commands.
  • Function, Tag, Import Auto Completion.
  • ActionScript 3 and Flex documentation search.
  • Drag and Drop of imports, includes, embed assets, css, xml.
  • ASDoc Support.
  • MXML Validation.
  • Manifest Generation.
  • Class and Component Templates.
  • Flex Builder compatible project creation.
  • Unused Import statement removal.
  • Shortcut Key Super Class, Code Behind and Import file opening.
  • Thanks to the following people who have all had a hand, although they may not know it, in the creation of the bundles:

  • Daniel Parnell
  • Theo Hultberg
  • Mark Llobrera
  • Joachim
  • ChromaticRain
  • Thomas Aylott
  • For those of you who don’t use subversion the following zip’s can be downloaded, but they won’t necessarily be the latest version :

    ActionScript 3 Bundle
    Flex Bundle

    Fork me on GitHub