Logic in Live Templates

Hi there,

me again..
I'm creating a whole lot of Live Templates for AS3 right now. Will publish them as soon as I'm finished.
I was wondering how much logic you can put into a snippet. There is this expression field, but I'm not sure how to use it or what it does.

So, I have a snippet to iterate through the children of a DisplayObjectContainer:

for (var $INDEX$:int = 0; $INDEX$ < $MOVIECLIP$.numChildren; $INDEX$++) {
  var $VAR$:$ELEMENT_TYPE$ = $ELEMENT_TYPE$($MOVIECLIP$.getChildAt($INDEX$));
  $END$
}


Now when I use DisplayObject as ELEMENT_TYPE I want to omit the cast that follows.
Is that somehow possible?

Cheers,
Tapete

1 comment
Comment actions Permalink

Hello hein,

This is only possible by writing an IntelliJ IDEA plugin with a custom live
template macro. Standard live template expressions don't support any kind
of custom conditional logic.

I'm creating a whole lot of Live Templates for AS3 right now. Will
publish them as soon as I'm finished.

I was wondering how much logic you can put into a snippet. There is
this expression field, but I'm not sure how to use it or what it does.

So, I have a snippet to iterate through the children of a
DisplayObjectContainer:

 $INDEX$ < $MOVIECLIP$.numChildren; $INDEX$++) {
> var $VAR$:$ELEMENT_TYPE$ =
> $ELEMENT_TYPE$($MOVIECLIP$.getChildAt($INDEX$));
> $END$
> }]]>

Now when I use DisplayObject as ELEMENT_TYPE I want to omit the cast
that follows. Is that somehow possible?


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.