The Amethyst 2 Outliner
An outliner (or document outliner) is useful in navigating a complex document or piece of code. But it can also be used to restructure a code file, sorting the various types of code fragments – private methods, properties and so on – to provide a more maintainable code base. Here I want to give you some information in the new outliner we’ve created for the forthcoming release of Amethyst 2.
The first thing you need to do is display the Document Outline tool window. This isn’t too obvious: you have to select View, Other Windows, Document Outline in order to create the outliner, though it is persisted in the .suo file when you close Visual Studio, so it will be there when you start Visual Studio up again.
The outline is created from the parsed ActionScript code and remains in sync as you edit or type into the code window:
When you click on an element in the outline, the corresponding code is made visible (scrolled into view if it isn’t already visible) and a margin marker is created to indicate clearly where the corresponding code is.
Right clicking on an outline element displays a context menu. You can do useful things like find references, display the call hierarchy for methods, and create a method ‘bubble’ ( a mini editor that just contains a method’s code). But more interestingly, you can restructure the code. On the context menu, you can see three menu items: Comment Item, Surround with Region and Restructure.
The first, Comment Item, simply comments out the selected item in the code window:
The second, Surround with Region, puts the tags //region //endregion around the item.
The most interesting one, though is the last one, Restructure. Using this, you can group all private methods say, after public methods and additionally ensure that the constructor is the first method in the class. Very useful for code maintenance!
This is a preview of the forthcoming version of Amethyst 2 – our ActionScript/Flash IDE for Visual Studio 2012 and 2010. If you buy Amethyst 1.0 for Visual Studio 2010 now you will be entitled to a free update to Amethyst 2 when it is released. See the Amethyst 2012 announcement for more information.