Hi, I format basically the way you do with id on top.
I have had a hard time putting the > on a separate line but, I can see why Adobe is starting to do it. It's like an end bracket of a method }. I also group attributes like width and height on the same line. To me that makes sense. also if you had padding, they would all go in the same line as well. Seems like a java expert could get a code formatter going in eclipse. I have looked everywhere for a good tutorial on how to make plugins in eclipse, it looks difficult. I am good with reg exp and could create an engine in java but as far as the eclipse plugin part, I still can't find a thumb sucking tutorial. :) Peace, Mike On 1/29/07, Pan Troglodytes <[EMAIL PROTECTED]> wrote:
I just wanted to throw this topic out there to share how I format my flex code and see what other people think. We all know how Flex does it by default. But I find those long lines hard to read as code. They are especially problematic for version control, as a change to any part of the line looks like a change to the whole line in a difference viewer. So, here's a fragment of my code. If you are using an email reader that changes this email to plain text, you may lose a bit of the point of it. <mx:HDividedBox id="historyBox" label="Activity " width="100% " height= "100% " styleName=" tabBox" > <mx:VBox height=" 100%" minWidth=" 240" width="240 " > <mx:TabNavigator id=" usersViewTabNav" height="100% " width=" 100%" change="usersViewTabChange()" > <mx:VDividedBox id="detailUserListTeam " label="Teams" width=" 100%" height=" 100%" > <mx:DataGrid id="teamGrid" dataProvider=" {WAT.teams}" height="20%" width=" 100%" minHeight=" 100 " verticalGridLines="false" change="detailUserListTeamSelectionChange()" > <mx:Button id="editTeamsBtn" label="Edit Teams" click=" editTeamClick()" /> I leave the id on the same line as the component declaration because that way it shows up in the Outline view (why it doesn't always put the id on the Outline view no matter what the formatting is, I have no idea). Otherwise, I put each attribute on a single line. This means any change shows up quite nicely in a difference viewer. I put the closing > or /> on a line of its own for the same reason. Unfortunately, Flex doesn't really respect this style and when working with the property editor it can tend to rearrange it. I then have to go back in and fix the formatting. What I really wish is that I could somehow make Flex/Eclipse aware of how I like to format things so that it would help me out. I also wish I could do something like alphabetically sort the attributes (leaving the id at the top) with a keystroke (kind of like the Organize Imports command). Would be great to have a command that would pretty-print all the source code in the open file. -- Jason
-- Teoti Graphix http://www.teotigraphix.com Blog - Flex2Components http://www.flex2components.com You can find more by solving the problem then by 'asking the question'.