AS3 Autocompletion in TextMate

Sep 26, 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.

Click to play.


Comments:

Lars - Nov 4, 2008

Great stuff! Simon, a bit off topic, but would you consider doing a similar video demo, with keystrokes, of the current ActionScript 3.0 bundle? I’m pretty sure I’m not using it to its full potential, or know what key combinations are optimal to use.


Matt Braun - Dec 5, 2008

I agree with Juan - ever since I left Windows I’ve had to put up with Flex Builder’s inferior codehinting. FlashDevelop really is one of the best ActionScript editors out there. Too bad it’s only available on an inferior platform… Looking forward to the release, thanks for all your work Simon.


Juan Bermudez - Nov 3, 2008

PLEASE RELEASE. I am not liking Flex Builder this will be my end of a long search that started when i left windows/FlashDevelop :(. Great Job!


Du Song - Jan 1, 2009

Just FYI, I’ve made a tmplugin to automatically choose between AS2 and AS3 tmbudle. http://blog.rollingcode.org/2008/12/Detect-ActionScript-23-in-TextMate


Cade - Jan 2, 2009

I just stumbled across this posting and it looks awesome. Any word on development/release?


lauritz - Nov 0, 2008

this will be very useful! you plan to release it as open source?


Roland - Apr 3, 2009

btw getter/setter and things like that just work fine.


Simon - Apr 3, 2009

@Roland - What you describe installation wise sounds good. Just make sure that TextMate doesn’t end up moving the bundle to a ‘Pristine Copy’ directory at the same level as the Bundles directory you specify above. On top of that you could try changing the commands output to ‘Show as HTML’ (you need to do this via the Bundle Editor), as this might reveal an error message. The command does spawn another process and the error could be in that, if it is then you won’t get to see it. Another place to look for a messages is ~/Library/Logs/TextMate ActionScript 3.log


Vikram Singh - May 5, 2009

Hi Simon, The bundle is working perfectly! However, there may be an issue with the Path searching abilities of the bundle. I had a working version of Flex in the ~/Flex directory. Perhaps I was using some old version of the bundle because then the fcsh compilation was working perfectly though auto completion was not working. Then I updated the bundle, auto completion started working great but when I tried to compile I got the error ‘Unable to locate fcsh’ though it was showing ~/Flex directory in the search path. After much hassle, I moved my Flex directory to, /Developer/SDKs/flex_sdk_3 every thing started working fine!


Simon - Mar 1, 2009

Thanks for the responses everyone. I’m trying to find the time to write a post and explain what’s what, but it’s taking longer than I expected. In the meantime, if you grab the latest version of the bundle (making sure it’s from the ‘master’ branch here or here) and make sure that you have the latest ‘Cutting Edge’ version of TextMate (via TextMate > Preferences > Software Update) you should start seeing completion working.


John C. Bland II - Oct 4, 2008

I’ll take a rough alpha…just lemme get my hands on it. :-)


Scott - Oct 3, 2008

This looks awesome! Do you have any idea of timeframe, as the blog post on blog.macromates.com that you link to is dated 2006. I can’t wait for this feature to become available, one less tick for Flex Builder.


Dylan - Sep 5, 2008

This is really excellent! Great work as always. Thanks. BTW: I’ve done a lot of customization to your AS3 bundle, including a custom nib file for project preferences. If you want to see what I’ve done, shoot me an email.


Joseph Magnani - Oct 2, 2008

Oh man, this looks amazing, can’t wait!


Martin - Mar 5, 2009

Make this happen and I’ll raise a statue of you on the north pole next to the one of Elvis that the KLF left there.


Rafael Rinaldi - Oct 4, 2008

Oh, nice. I’m excited waiting this feature, Simon. And i agree with Ronnie.


ali - Apr 1, 2009

Hey Simon, thanks for your continued work on this bundle, I love writing and compiling AS3 in Textmate. I have auto completion working on one of my computers but I doesn’t work at all on my Macbook, there is no response when I use the alt/escape shortcut except when I try to add an import and I get this error message: /tmp/temp_textmate.N3KUfw:3: command not found: /Users/ali/Dropbox/Libraries/TextMate/PlugIns/Dialog2.tmplugin/Contents/Resources/tm_dialog2 -u /Applications/TextMate.app/Contents/SharedSupport/Support/lib/ui.rb:200:in /bin/bash: -c: line 0: unexpected EOF while looking for matching `’’ /bin/bash: -c: line 2: syntax error: unexpected end of filemenu’ from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/ui.rb:195:in /bin/bash: -c: line 0: unexpected EOF while looking for matching `’’ /bin/bash: -c: line 2: syntax error: unexpected end of filemenu’ from /Users/ali/Library/Application Support/TextMate/Pristine Copy/Bundles/ActionScript 3.tmbundle/Support/lib/as3/tools/source_tools.rb:146:in I’m using the latest version of Textmate and the latest version of yr bundle. Any suggestions much appreciated. Thanks, Alistair


ali - Apr 1, 2009

and one more quick question: How did you generate the line of code var box:Object = new Object(); in your video? do you have this stored as a snippet or command or is this another feature of auto-completion? Thanks Ali


tf - Oct 5, 2008

awesome / want / need / now / etc


Matthew Kanwisher - Dec 2, 2008

Put it up on Github I would love to help!


Roland - Apr 3, 2009

okay. there is no copy of the bundle. i just tried to print html. the result is following: /Library/Application Support/TextMate/Bundles/ActionScript 3.tmbundle/Support/lib/as3/parsers/class_parser.rb:517:in `directory?': can’t convert nil into String (TypeError) from /Library/Application Support/TextMate/Bundles/ActionScript 3.tmbundle/Support/lib/as3/parsers/class_parser.rb:517:in `add_src_dir’ from /Library/Application Support/TextMate/Bundles/ActionScript 3.tmbundle/Support/lib/as3/parsers/class_parser.rb:507:in `create_src_list’ from /Library/Application Support/TextMate/Bundles/ActionScript 3.tmbundle/Support/lib/as3/parsers/class_parser.rb:97:in `initialize’ from /tmp/temp_textmate.8kvgJJ:10:in `new’ from /tmp/temp_textmate.8kvgJJ:1 doesn’t sound good, does it?


Matthias - May 0, 2009

sorry, I used the outdated SVN repository URL. Now I saw the Autocompletion welcome screen and another happy user of the autocompletion feature. Really great work!


gaw.in - Apr 2, 2009

DTrace to the rescue: I noticed some calls to ‘/Developer/SDKs/flex_sdk_3/bin/bin’. Note the double /bin in the path. Solved it by reinstalling the Flex SDK, and resetting the ‘TM_FLEX_PATH’ variable.


Adam - Mar 4, 2009

It seems the Dialog2 plugin isn’t included with TextMate yet. If you grab it from http://svn.textmate.org/trunk/Support/Dialog2.tmplugin and put it in ~/Library/Application Support/TextMate/Plugins the auto-complete will work as advertised in the video. This bundle is fantastic. I just discovered TextMate today and everything just works. Refreshing when I’m used to Flex Builder where next to nothing just works.


Brett Walker - May 1, 2009

So, does AS3 autocompletion only work with the intrinsic Flash classes? I thought it would use the TM_AS3_LIB_PATH environment variable, but it doesn’t seem to recognize any classes within that path. :(


Martin - Apr 6, 2009

Simon, you are now officially my hero. Thank you so much for this excellent addition to the finest editor out there which only goes to make it even more awesome.


Matthias - May 0, 2009

Hello Simon, great work! Even though it doesn’t work for me. I have also the latest cutting edge version of textmate 1498 installed. I installed the as3 and flex bundle from svn and had just like Roland to create the Bundles folder before. When I hit Alt+ESC, I get the message ‘Please select a class to locate the package path for.’ and I don’t know, how to go on. Any help would be appreciated. Regards, Matthias


daniel - Oct 6, 2008

when are you going to release this? Textmate needs to autocomplete for actionscript already. Be a hero!


ali - Mar 5, 2009

this bundle is now at: http://svn.textmate.org/trunk/PlugIns/Dialog2.tmplugin/


Simon - Apr 3, 2009

@Roland - Actually that is good for me as it’s something concrete to fix ;) If you open /Library/Application Support/TextMate/Bundles/ActionScript 3.tmbundle/Support/lib/as3/parsers/class_parser.rb at line 507 and append unless fx.nil? to that line you may find that things work, or you may get a different error message. Either way please let me know and thanks for persisting with this. I have committed this change to my working branch, so if you take a look at the change here http://github.com/simongregory/actionscript3-tmbundle/commit/d4236 for some extra clarity.


Ian Moreira - Apr 5, 2009

Thanks Simon! I had the same problem as Roland above. It is working perfectly.


Tomek - Oct 3, 2008

Yes, after it’s released I can finally forget about Flash Develop for Windows :D


Wes - Sep 5, 2008

Looks like just the ticket! This is really going to seal the deal on using TextMate as my as3 development tool of choice. Also, you are the king of shortcuts. After watching the video, I wasn’t sure if you were coding AS3 or playing streetfighter.


Roland - Apr 3, 2009

Hey Simon, thanks for the quick reply. I haven’t made any modifications. I just grabbed the bundle from textmade subversion and placed it in Library/Application Support/Textmate/Bundles (I had to create it before) I just restarted Textmate and set the language to ActionScript3. Then I just typed the same code you are running in the movie above. Just hit Alt+Esc, but nothing happens. Only the first time a popup comes up and tells me that Auto Complete is in Alpha State. I said “continue” and “Happy Coding!!” came up. But from then on there is nothing that works. I think I am too stupid for that. I am really sorry because I think it is definitely my fault.


Ronnie - Sep 6, 2008

Looking forward to this. Mac is really missing a good AS3 editor.


Brett Walker - Feb 3, 2009

Simon, I saw that you committed this functionality to the public build after Dialog2 was moved out of review, but I can’t for the life of me get this to work. When I try to replicate any of the things you do in your sample video, either by using shortcut keys or the menu item, the completion never shows a popup menu. I really really want this to work! Any ideas on where I went wrong?


Justin - Feb 2, 2009

Along with everyone else… any news would be much appreciated :) Looks awesome.


Dillone - Oct 3, 2008

Wonderful! Awesome! Would you please release it ASAP!


Tadhg - Jan 5, 2009

Agreed, this looks great and exactly what I’ve been looking for. Any news on a release date?


Roland - Apr 4, 2009

Ha!!! It works perfect! Thank you very much simon for your pacient and help.


gaw.in - Apr 2, 2009

Simon, I seem to have a different error. Textmate Build 1498 Freshly cloned from github: git clone git://github.com/simongregory/actionscript3-tmbundle.git “ActionScript 3.tmbundle” Following the same example as in your movie I am unable to see the autocompletion. Just changed the output to ‘Show as HTML’. Below are the results: [ESC] is where I pressed Alt+Escape super();[ESC] -> No property found. add[ESC] -> (${1:v:Point}) var box:Object; (box as List).i[ESC] -> Just nothing happends Running ‘Auto Complete Function’ from the menu: -> ()${1:;} Most of the time just nothing happens, any idea where to look? (‘~/Library/Logs/TextMate ActionScript 3.log’ doesn’t exist) Thx in advance!


Roland - Apr 2, 2009

Hey Simon, I just updated my TextMate and grabbed the latest version of the as3 bundle and also grabbed the Dialog2 plugin. I installed the bundle and the plugin but it seems that it does not work. I just tried to do the same things you did in the movie, but no hovertip comes up. Do you have any suggestions what I am doing wrong?


Simon - Apr 2, 2009

@Roland - If you have the latest version of TextMate then you don’t need to install Dialog2 as it’s distributed with the app. Have you made any local modifications to the bundle? Are you invoking the command from the right scope - ie with a class when the language is set to ActionScript 3 ?


Jaap van der Meer - Mar 4, 2010

Hi Simon,

I created a rubygem textmate_fcsh. It lets textmate make use of fcsh and it also fetches the errors so they get nicely formatted. Are you interested to combine it in your Actionscript plugin? It needs some work, still tuning… Wrote a blogpost about it here: http://www.jaapvandermeer.com/2010/03/01/textmatefcsh-compile-flex-in-textmate-using-fcsh/

Thanks for your actionscript plugin, like it a lot!


Textmate: code hinting, auto-completion | David Pett - Oct 1, 2009

[…] his blog post for more […]


palmerama.tv | » AS3 AutoCompletion in TextMate - Aug 1, 2009

[…] great is its expandability with Bundles. Simon Gregory has for a while now been maintaining the only AS3 bundle worth a look and a good while ago now it got really, really good with the addition of text […]


dandylion_13 - Sep 5, 2009

With some help from this website: http://www.matthijskamstra.nl/blog/index.php/2009/04/29/textmate-as3/ .. I was able to get the bundle working. However, there appear to be a bug somewhere. When I attempt to build a project, I get this error message: “Unable to locate fcsh” One of the locations is searches is “/Developer/SDKs/flex_sdk_3.4/bin” . This is exactly where fcsh is located. I’ve been stuck at this point. If anyone can help, please leave a post below.. thank you :)


Lars - Sep 4, 2009

Hi Simon, and a million thanks for this bundle. Is it possible to make the autocompletion work for the classes I write myself without having the source files in a folder named “src”? The thing is, me and my colleagues (of mixed tools and OSes) have a bunch of projects already set up, in subversion and so on, without any folder named “src”. Instead, directly under the project root folder, we have a folder structure like com/mydomain/application and such. So it feels a bit frustrating that I can only get the autocompletion to work if I move the entire file structure into a folder named “src”. Especially since auto import works splendid with our current file structure, but not the autocompletion. So, is there any configuration or alteration I can do to get around the “src” folder requirement?


dandylion_13 - Sep 5, 2009

I was able to find out what was causing the problem above: The Flex sdk which I downloaded from Adobe was zipped in such a way that the unix executable files (like fcsh) were recognized as plain text files. This confused Textmate. Unfortunately there is no way to restore their application signature without actually editing the file manually, which I’m not able to do. The only solution I found was to download the Flex 4 sdk beta. These files retained their unix executatble signature and Textmate was able to launch fcsh without problems.


Build ActionScript3 projects with TextMate in 5 easy steps | Floorplanner Tech Blog - Sep 1, 2009

[…] creating a TextMate bundle for ActionScript3. The most important things that the bundle handles are auto-completion and auto-import. You can download it directly from his blog, or fetch it with Git or […]


ali - Oct 3, 2009

Hi again Simon, after using Flex Builder for a few months Ive come back to Textmate as it is so slow and heavy and I really miss bundles and the speed of TM. Anyway, I tried to get automcompletion working again and for some reason Textmate can’t seem to locate my classes directory (I presume) as the log reads: Type locally matched as Sprite. Located ‘myS’ as Sprite Unable to load ‘Sprite’ when I try autocomplete on a sprite instance I’ve just created. If you could suggest what I’m doing wrong I’d be really grateful. Thanks for all of your work and for making this public, Ali


Matthew Sloan Wallace - Oct 1, 2009

I got a chance to check out the latest bundle including the autocomplete and intellisence. Awesome work man. Please keep up the good work. I am pretty close to ditching the other IDE’s for my Actionscript development. Infact I just started a project over the weekend to use with textmate so that I can play around with these great features. Awesome, just awesome.


Brett Walker - Feb 3, 2010

I guess Simon is no longer working on this bundle? No commits in months. It’s a shame, it’s so close to being “insanely great” as Jobs likes to say. I just want it to work with my own classes. :(


Aumenta tu productividad con symfony gracias a Textmate y sus Bundles « Web, don't stop - Jun 5, 2010

[…] AS3 Autocompletion in TextMate :Autocompletado a partir de clases […]


Christian - Mar 3, 2011

Hi Simon,

autocompletion does not work if the function name to call is capitalized.

example:

THIS WORK public static function replaceDot(s:Number):String { ...}

THIS WONT LOAD public static function ReplaceDot(s:Number):String { ...}