Home  >  

ActionScript and MXML Pretty Printer

Author photo
| | Comments (6)
AddThis Social Bookmark Button

I previously blogged about the importance of coding standards, and offered my opinions on what beautiful code looks like. Regardless of whether you accept my code formatting conventions for yourself or not, there is an excellent Eclipse plug-in that can format ActionScript and MXML code to your taste.

Download Flex Formatter and see for yourself.  Here is a configuration file that implements the vertically compressed formatting that I espouse.

Update: Here is the Eclipse update site:
http://flexformatter.googlecode.com/svn/trunk/FlexFormatter/FlexPrettyPrintCommandUpdateSite

_______________________________

Mike Slinn
Independent full-service software contractor and author
http://slinnbooks.com
http://mslinn.com

Read more from Mike Slinn. Mike Slinn's Atom feed mslinn on Twitter

Comments

6 Comments

Jack Mitchell said:

Mike,

This is a great plugin. Thanks for telling me about it. One question I have is how to import the configuration you gave above?

Thanks,
Jack

Mike Slinn said:

Windows:
Window / Preferences / Flex Formatting / Import ... button
Mac:
Eclipse / Preferences / Flex Formatting / Import ... button

The Import and Export buttons are at the bottom of the dialog panel.

Ernest said:

Hi. I looked at your FlexFormatter .properties file and then read your previous blog entry. One thing you didn't appear to take advantage of is the ability to sort mxml attributes alphabetically (or perform other custom orderings).

1. Go to Window->Preferences->Flex Formatting----MXML\Configure custom attribute order...
2. Uncheck the "Don't use custom attribute order and line breaks" button and check the "Sort any remaining attrs" button and hit OK.

If you want to make special cases for attributes like 'id', 'width' etc. you can do that as well in the ordering table.

Mike Slinn said:

I missed that, and I want to use that feature. Thank you for pointing it out!

Mike

Mike Slinn said:

I updated the preferences file that is linked in the blog posting.

Tahir Awan said:

I just installed the plugin. It is working ok for MXML but not so good for action script blocks in the MXML files.

Hope I don't have to select/highlight MXML code to format/indent.

Thanks,
Tahir

Leave a comment


Tag Cloud

Question of the Week: Dream App

If you had an unlimited budget and unlimited resources what application would you build and why would you build it?

Answer

Latest Features

Recommended for You

@InsideRIA on Twitter

Archives

  • Or, visit our complete archive.  

About This Site

Welcome to the premiere community site for all things RIA sponsored by O'Reilly Media and Adobe Systems Incorporated.