the blog
Back to -Blog

ActionScript IntelliSense in Amethyst

Code Completion for Flex
by Dermot Hogan
Monday 5 January 2009.

I’ve just completed the fundamentals of the ActionScript IntelliSense for Amethyst Personal and Professional Editions. Overall, it’s not gone too badly – this is the second time I’ve done something like this (the first time was for our Ruby IDE, Ruby In Steel). All I can say is that it was a lot easier the second time round!

In fact, it’s quite instructive to compare Ruby with ActionScript IntelliSense. On the one hand, with Ruby, everything is very dynamic and it is, in general, very difficult to get the exact IntelliSense for a given object. On the other hand, with ActionScript you generally know exactly where everything is. The downside is that there’s no excuse for getting it wrong: with Ruby I could always (on the bad days) shrug my shoulders and say "Well, dynamic languages, you know what they’re like … !"

It turns out that ActionScript is well behaved from an IntelliSense perspective – you can parse a compiled ActionScript file and haul out the data you need. Similarly, the source code can be parsed easily (unlike Ruby). With ANTLR 3.1 I had a complete lexer/parser/tree generator up and running in about eight weeks. However, while this does indeed produce the database for IntelliSense, it allows me to do much, much more, and we’ll be making good use of ANTLR for some of our future Amethyst goodies.

Visual Studio IntelliSense really boils down to (more or less) four main areas:
- Member completion – what you get after a ‘.’ or ‘::’
- Word completion – what you get when you type CTRL-SPACE
- Parameter completion – what you get after an opening parenthesis in a method
- Tooltips – the nice help tips that you get when you hover over a method call, say.

In addition, there’s ‘goto definition’ and the navbars that allow you to zip around the file and project.

Amethyst Personal (our free edition) will have ActionScript member completion, word completion and navbars. Amethyst Professional (our commercial edition) will have the full range of IntelliSense features mentioned above plus some other features which we will announce later. The next Amethyst beta, due out soon, will have Personal Edition IntelliSense. We will release a beta with Amethyst Professional’s IntelliSense in the near future.

I’ve got all of the above-mentioned IntelliSense features working without any trouble (well, mostly). Here’s an example – note the default/optional arguments that are displayed

and here’s another showing the member completion after typing a ’.’:

For member completion, I’ve used two tabs – one for the direct members of an object and the other for those plus the members derived from an object’s ancestors.

One of the ActionScript features that did give me a bit of trouble was namespaces. They work differently from, say, C# namespaces and it took a bit of pushing to get the IntelliSense working correctly. Here’s one example, correctly showing the type of the variable orange:

And here’s another showing the completion list you get after typing ‘::’ - again correctly showing the appropriate members of the namespace.

I’ll go into a bit more detail in another Blog entry shortly.

Bookmark and Share   Keywords:  Amethyst  development  IntelliSense
© SapphireSteel Software 2014