Home >
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




Facebook Application Development
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
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.
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.
I missed that, and I want to use that feature. Thank you for pointing it out!
Mike
I updated the preferences file that is linked in the blog posting.
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