Flex Formatter Plugin

Code formatting is the reason for many a jihad between developers all over, and spending any time at all discussing it is a waste of time.  (So should I stop writing here?  No!  There is an answer!  Press on…)  Unfortunately this is one issue where it’s impossible to make everyone happy, so you have to settle for making everyone equally UNhappy.

A really painless way to do make everyone equally unhappy is to automate the formatting, and that’s where the amazing little gadget, the Flex Formatter plugin for Flex and Flash Builder comes in.

The plugin adds a few buttons to the toolbar area of Flex Builder.  These buttons are:

  • Generate ASDoc Comments – For your whole file!  In one click!
  • Generate ASDoc Comment – For one item (also in one click!)
  • Format Flex Code – Formats your entire MXML file (or selected lines) ….with one click
  • Indent Flex Code – Not sure why you’d use this and not just the previous button, it seems to do the same thing
  • Rearrange AS Code – Same as Format Flex Code, but for your AS files

To install it, go to “Help, Software Updates, Find and Install” and install from the new remote site:

http://flexformatter.googlecode.com/svn/trunk/FlexFormatter/FlexPrettyPrintCommandUpdateSite/

Grant Skinner has a nice post on this, as well as a settings file that he has exported for use: http://www.gskinner.com/blog/archives/2009/12/indispensable_p.html

Spread the love!
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

1 Responses to “Flex Formatter Plugin”


  • Thanks for the writeup. A couple of comments about your post though:
    1. The Format flex code button is for both mxml and actionscript. The format button will also perform the rearrange functions at the same time if that option is checked in the preferences.
    2. Indent only affects leading whitespace, whereas format adds and removes newlines and space within a line (in addition to adjusting leading whitespace).
    3. Rearrange flex code doesn’t format per se. It reorders actionscript class elements, whether they appear in mxml or as files. This is exposed as a separate button because it probably doesn’t make sense for most users to reorder their methods every time they format. However, they can set the option that does rearrange while formatting if they want to run the formatter over a large number of files.

Leave a Reply

Powered by WP Hashcash