views:

485

answers:

2

How can I force flex to cuddle my curly-braces instead of putting them on a new line?

A: 

what exactly do you mean force them on a new line? when you define a method? or when your doing bindings?

Faisal Abid
An example of cuddled vs new line: http://www.gskinner.com/blog/archives/2008/11/curly_braces_to.html
David
+3  A: 

I'm going to make the assumption that you are talking about Flex Builder. I'm specifically using Flex Builder 4 beta (Flash Builder), but I think this applies for Flex Builder 3.

When asking fb to create a new actionscript class, you can adjust the template and set it to cuddle the braces, but only for the class definition. The template settings can be found under Window -> Preferences -> Flash Builder -> File Templates.

A better option is the Flex Formatter plug-in, which can be found at Source-Forge here. Note the installation instructions here which are different depending on which version of Eclipse you are running.

Once you get the plugin installed, you'll see a number of new setting available under Window -> Preferences -> Flex Formatting. The one you are looking for is buried a bit. Look under Flex Formatting -> ActionScript -> Newlines/Wrapping -> Line Breaks -> Brace Style.

Set as desired.

Once that is all done, just go to your selected actionscript file, and press the Ctrl+Shift+F keyboard shortcut. And there you have it.

Easy Peasy, Lemon Squeezy.

Rydell
Thank you! That's exactly what I was looking for.
David
Thanks! Found you're reply via Google, just what I needed!
Tyler Egeto
+1 I was looking for this feature for a long time. Hello, cuddly braces! :)
Arms