the blog
Back to -Blog

Adobe Flex IntelliSense in Amethyst

Code completion and more...
by Huw Collingbourne
Tuesday 13 January 2009.

We’re just finalizing some of the IntelliSense features which will be in beta 2 of our new Flex IDE, Amethyst.

Being a long-time Visual Studio user, I would find it very hard indeed to program without good IntelliSense. We have previously developed an IntelliSense system for the Ruby language - which was really hard work bearing in mind that Ruby doesn’t even have type declarations, and a single Ruby identifier can change its type from one line of code to the next. With our Flex IntelliSense we are making good use of our experience with Ruby to develop a fast and accurate system of IntelliSense for both ActionScript and MXML.

IntelliSense is just member completion. Beta 2 of Amethyst also provides Nav Bars, ‘import’, class and keyword completion - and there’s more to come in subsequent betas...

I should say at the outset that the IntelliSense features of beta 2 are far from complete. There are some things that are missing (such as auto-expanding code snippets and function parameter tooltips) and much else that is not yet fully implemented. Even so, we now have decent code completion that provides context-sensitive lists of members and keywords and also works with import statements and drop-down ‘Nav Bars’ to let you go to specific methods, variables and declarations by picking items from lists.

Nav Bars provide quick code navigation

Dermot Hogan (the chief architect of Amethyst) has already written a bit about Amethyst’s IntelliSense and he will go on to explain some of the finer points in another blog entry soon. However, just to give you a personal perspective on this, let me try to guide you to a couple of the things that I personally find particularly useful.

Based once again on our experience with Ruby, we have decided to provide a two-panel code completion dropdown list, similar to the one used in VB .NET. The problem I find with many ActionScript classes is that they inherit so many methods from their ancestors that it’s hard to see the wood for the trees. In particular, when I write my own classes, I generally want completion only for the small number of methods that I have written rather than for the huge number of methods that the class inherits from the Flex/Flash class hierarchy.

In Amethyst, I can choose to display only the members of a specific class by selecting the ‘Common’ pane. But if I want access to all the inherited members too, I just switch to the ‘All’ pane. Amethyst’s IntelliSense remembers which pane you selected and will continue to use that one unless you select the other.

In the Common pane my class displays only its own (not its ancestors’ methods)...
...but switch to the All pane to view all available members (including those derived from ancestor classes)

Another great time-saver is the ability to refer to controls which are declared inside MXML. If an id has been set in MXML (say button1) then my ActionScript code will automatically produce a code completion list for a Button object if I enter a dot after the identifier: button1.

The Nav Bars, incidentally, work both with MXML and ActionScript. If a control is created in an MXML section, then I can go to it by id (if it has one) or by class name (if it hasn’t). Since unique ids are so much easier to identify, I’d strongly recommend making a habit of using them in your MXML. This will also be a benefit when we release our visual designer in a future beta. While ids are not enforced in Flex (or Amethyst), they certainly make design, coding and IntelliSense a good deal easier to use.

Our free (‘Personal’) edition of Amethyst will include ActionScript code completion. However, some features in beta 2 of Amethyst may only be available in the commercial (‘Professional’) edition. We will start adding more Professional Edition features to future betas.

Beta 2 of Amethyst will be available for download from the SapphireSteel Software site in a few days.

Bookmark and Share   Keywords:  Amethyst  development
© SapphireSteel Software 2014