Flash Builder Snippet Plugin

For those of you who are on the dev road with Adobe’s latest piece of software, the Flash Builder, here is a very interesting plugin, I’d like ton recommend, made by Flash Platform Evangelist Lee Brimelow. It is called “Flash Snippets” and integrates very well into my personal workflow. The snippet tool enables you to define custom pieces of code, which you can enhance with variables.

For example:

You want a snippet to generate a function, but you want a very abstract and universal snippet, so you can use it over and over again for functions with different names, parameters, parameter types and return types. What I mean is you could generate these two functions with just one premade snippet:

private function doSomething(what:Action):void
{
    // doing doing doing....
}

private function eatSomething(meal:Food):String
{
    // eating eating eating....
}

You can clearly see the differences between those two functions. The names, parameters, their types and the return types differ.

The snippet would look like this:

(Notice that the comment block above the function can also be added directly to the snippet)

/**
 * $${name}
 */
private function $${name}($${Argument}:$${ArgType}):$${Return:void}
{
	// the cursor would be placed right here for you
}

My trigger for that snippet is pf for private function.
When I hit my shortcut, a dialog appears, where I can quickly fill in my variables.
Notice that variables can also have a default definition like the return type of my example snippet above $${Return:void}

When first working with the panel, you will need to define a shortcut to invoke the triggers, defined in your snippets. Your shortcut should be something that is not already in use by Flash Builder, and/or not important and it should be easy to remember for yourself. Notice, that one shortcut will invoke all your triggers.

Of course Lee himself made up a tutorial on how to use the snippet panel and you can see it on his blog. Furthermore you’ll find the download link and a step-by-step instruction on how to install it.

Hint:

If you are on a Mac and want to port your snippets; they are stored in an XML file in Flash Builder’s workspace folder:

/.metadata/.plugins/Flash_Snippets/snippets/

EDIT

I just installed FDT 3.5 and found out, that Lee Brimelow’s snippet panel seamlessly integrates in FDT. I mention that, because there is a lot of tumult with Eclipse plugins and Eclipse versions they can run in!

A lot of people stated that, for example, the snippet panel won’t run in Flex Builder 3.

Conclusion

As mentioned before, Lee Brimelow’s snippets panel enables you to predefine certain templates which you can implement variables in. Once you’ve set up all your snippets, your coding speed will explicitly increase. This is an amazing and remarkable tool. Download it, watch Lee’s introduction video and play around for yourself. Notice that Lee states “I am releasing an early test version of the snippets panel”, so don’t be upset about bugs or other problems you may encounter. I myself did not have a problem with it yet.

Tags: , ,

6 Responses to “Flash Builder Snippet Plugin”

  1. Bobbie Boruvka says:

    Thanks for publishing about this. There’s a bunch of good tech info on the internet. You’ve got a lot of that info here on your site. I’m impressed – I try to keep a couple blogs reasonably up-to-date, but it’s a struggle sometimes. You’ve done a big job with this one. How do you do it?

  2. thastyle says:

    Great stuff been using this for a few months now, and nver came back to say thanks, do you happen to know a better way to share the snippets between seperate workspaces then storing in the workspace folder… i am also dying to find out where i can add file templates, not just edit the few avaible , and if that is not possible is it possible to add extra wizzards tagz ?
    i know a lot at once anyways thanks, i aloso say the option to save as file template but somehow i cant get that part to work.. i have been using sourcemate for a while was kind of hooked but i dont wanna pay for shit that should have been included in the first place…. thanks again bro

    • Aiden Tailor says:

      sorry buddy, I can’t answer your questions.
      You should get in touch with the developer of the plugin (Lee Brimelow http://www.theflashblog.com)
      I have only been using this for a very short time – switched completely to FDT

      • ThaStyle says:

        Thanks for your responce bro, well the new air 2 native shit, sort of solved my problem, i can run a set of batch files that allow me to control the workspace syncin..
        just made a little proggie that watches those folders ..
        i got the new fdt installed here but somehow cant get pf10.1 in debugging mode, compiling is working. i always used flashdevelop because of its speed, maybey i just need to give fdt some more time. although i must say that ever since i use flashbuilder 4 with no autocompiling all is done by ant tasks and i also added my global namespace and includes to the sdk folder, this made so much of a difference.
        does the plugin manager also work in fdt ?
        can u send me 2 basic little projects so that i can better understand the structure ?
        at this moment i am building something like http://labs.adobe.com/technologies/airlaunchpad
        with lso and a few wizzards.
        love ur blog and thanks
        Greetz Peter

        • Aiden Tailor says:

          Hey Peter,

          seeing you write about a tool that keeps your workspaces in sync sounds very interesting! I find it quite annoying in every eclipse that (for example) shortcuts are stored in each workspace serperately. A tool that keeps all my workspaces’ shortcuts in sync would be tremendiously helpful in everyday life!

          FDT should work fine with FP10.1 – that seems like an issue with your local maschine.

          ANT is installed in FDT by default wo you should be able to take your workflow over to FDT and even optimize it in the new IDE.

          When you are using FDT you do not need the FB Snippet Manager because FDT has a very powerful solution right built into its core. You should check some demos on Youtube (just search for FDT quick fix and/or templates)

          If you would explain your request about the two little projects I am pretty sure that I can help you, but at this moment I do not really understand what was on your mind ;)

          Regards,
          Aiden

Leave a Reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>