Action Snippets and Selected Text?

I come from a FlashDevelop background and I was wondering is it possible to select some text e.g.

anInteger

Select the text and press a keyboard shortcut so it becomes:

trace("[anInteger]:",anInteger);

Similar to ActionSnippets in FlashDevelop, can this also be achieved with Live Templates?

Thanks in advance

:)

5 comments
Comment actions Permalink

Yes, you have found an answer yourselves, you can add your own Live Template. When editing text you can see live templates available in context using Ctrl+J on Windows (Cmd+О on Mac). To expand template select if from preview list or, easier, type its abbreviation and press Tab.

0
Comment actions Permalink

What $VAR$ do I use for the currently selected text?

0
Comment actions Permalink

$SELECTION$

To use live templates based on selection in editor use 'Surround with' action (Ctrl+Alt+T on Windows, Cmd+Alt+T on Mac) or 'Surround with live template' (Ctrl+Alt+J on Win, Meta+Alt+J on Mac).

0
Comment actions Permalink

What about getting the className and methodName in Flash because many of the Expression functions in the Template Variables aren't there.

0
Comment actions Permalink

Not sure I fully understand the question, but probably this is the answer:
- Make sure you have checked that your custom live template is applicable for ActionScript (link to do it is below the template text area)
- Write var with any name in the template text, say $CUSTOM_VAR$
- Click Edit Variables button and assign jsClassName() or jsMethodName() as var expression

0

Please sign in to leave a comment.