Idea various code generation quick integration of Live Template

Idea generation and efficient integration of various

Rapid generation method method comment

Configuration

  1. Open Idea ---> Settings, live search

1568000984827

  1. Right click the + sign to create a set of templates Template Group, after re-create the template Live Template, the template name *

* Here we use as a template name, and the use of non-indented * as the first line of content in the template. Convenient method we use when creating the / * and then tab to create a method comment. So we do not need to change operating practices. Is not it feel more convenient!

001

  1. Template reads as follows:
*
 * 功能:
 * $VAR1$
$params$
 * @return $returns$
 * @author Keats
 * @date $date$ $time$
 */

After using the variable name $ $ define variables in the template, you can edit the contents of the variables in the right side of the Edit Variables

1568005308004

Here the method name are the words too literally, I do not too much to explain, script code param variables are as follows:

groovyScript("def result=''; def params=\"${_1}\".replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList(); for(i = 0; i < params.size(); i++) {result+=' * @param ' + params[i] + '\\t' + ((i < params.size() - 1) ? '\\n' : '')}; return result", methodParameters())

Paste this code into the input box, after confirming press Enter, OK save.

  1. Finally, set the template is valid EveryWhere

1568005507647

Examples of Use

002

Guess you like

Origin www.cnblogs.com/keatsCoder/p/11491305.html