Tuesday, February 14, 2012

My list of useful Intellij Live Templates


I like Intellij's "live templates" feature and I try to use it as much as possible.
Here some live templates I just can't do without.

cdata
<![CDATA[ $TEXT$ ]]> $END$
assign to XML context.
debugger
debugger; /**nocommit**/ 
assign to Javascript. the "nocommit" is a precommit hook I have that makes sure it won't be committed.
logger
private final static Logger logger = logger.getlogget($CLZZ$.class);
CLZZ is an Expression "className()" and I skip it if defined. ( This way there's usually nothing to edit ).
Assign it to Java code.
method
$METHOD$
METHOD is the expression "methodName()" and skipped if defined.
Assign it to Java String. It is helpful to add the method name in log prints.
single
$ACCESS$ static final $CLASS$ instance = new $CLASS$();

ACCESS has a default value of 'public', and CLASS is "className()". (not skipped if defined).
Assign it to Java code.

No comments :

Post a Comment