Thursday, May 05, 2011

Using Flex Formatter with IntelliJ

Flex Formatter is one of my favorite plugins for FlashBuilder, unfortunately there's no plugin version for IntelliJ.

But thanks to IntelliJ's "External Tools", you're able to use any tool that can be run from the command line (think apparat, sprouts, etc) and execute it with a keyboard shortcut within IntelliJ! The video below shows you how:




Running FlexFormatter from the Command Line:
http://sourceforge.net/apps/mediawiki/flexformatter/index.php?title=FormatterCommandLine

Download the files below:

FlexFormatterJars:
http://sourceforge.net/projects/flexformatter/files/flexformatter/0.8.4/FlexPrettyPrintCommand_0.8.4.zip/download

CommandLineSupportJars: http://sourceforge.net/projects/flexformatter/files/flexformatter/CommandLineSupportJars/commandLineSupportJars.zip/download

Sample Formatter.properties file:
https://github.com/as3/as3-utils/raw/master/res/flex-formatter.properties

10 comments:

  1. Than you! Cool util!
    I have long dreamed about the utility sorting methods.

    ReplyDelete
  2. Nice information and i got a lot from this video.,

    ReplyDelete
  3. Nikos6:15 AM

    cool but IDEA already has ctrl + shift + L reformat code

    ReplyDelete
  4. Anonymous6:21 AM

    FlexFormatter supports element reordering, attribute reordering, and other super advanced formatting features not found in IntelliJ's formatter.

    ReplyDelete
  5. Ricardo Schalch4:38 PM

    Are you ok man ? Where are the old anf good tutorials ? ^ ^

    ReplyDelete
  6. Anonymous4:39 PM

    Yup, I'm alive and kickin'. Just been working on some side projects rather than tutorials recently. Too many things in life to do, eh?

    ReplyDelete
  7. Wow thanks thats very nice. I am just making the switch form Flash Builder to intelliJ. Flex formatter was one of my favourite plugins from Flashbuilder so its awesome I can use it in my new IDE, handily I put my properties file in dropbox to share between my machines, so I can point the external tool at that and if i ever need to muck around with the settings I just open Flashbuilder on my work computer.

    ReplyDelete
  8. Nice.. I was looking for that. Thank you, John!

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. I followed the same exact steps but I got the below exception. Any Idea ?

    C:\Program Files\Java\jdk1.6.0_35\bin\javaw.exe" -Djava.ext.dirs=. utilities.CommandLine " C:\Users\cyeluri\Trellis\Branches\R2.1-DEV\OneLineDiagram\src\main\flex\com\avocent\trellis\domain\model\UserPreferencesModel.as" C:\Users\cyeluri\tools\flexFormatter\Formatter.properties 4 true
    Error: File/Directory does not exist: C:\Users\cyeluri\Trellis\Branches\R2.1-DEV\OneLineDiagram\src\main\flex\com\avocent\trellis\domain\model\UserPreferencesModel.as
    Usage:
    [0]=full file/directory path, required parameter
    [1]=location of property file with settings, default=empty property set
    [2]=tabSize, default=3
    [3]=true->format, false->indent, default=false
    [4]=java charset name, ex. UTF8. Defaults to the default charset.

    ReplyDelete