idea live template config
1 template
code
*
* $description$$END$
*$params$$return$
* @date $date$ $time$
*/
文字解释
- 第一行 "星号"顶格
- 第二行 空格+"星号"+空格+description参数+END参数
- 第三行 空格+"星号"+params参数+return参数
- 第四行 @date+空格+date参数+空格+time参数
- 第五行 空格+"星号"+反斜杠
截图
![](https://img2018.cnblogs.com/blog/478956/201911/478956-20191108141751446-2120153021.png)
2 script
script code:
params: groovyScript("def result=''; def params=\"${_1}\".replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList();if(params[0].trim().equals('')) return ''; for(i = 0; i < params.size(); i++) {result+= '\\n * @param ' + params[i] + ' ' + params[i]}; return result", methodParameters())
return: groovyScript("def returnType = \"${_1}\"; if(returnType == 'null' || returnType.length() == 2 || returnType == 'void') {return '';} else{return '\\n * @return {@link '+ returnType +'}';}", methodReturnType())
截图:
![](https://img2018.cnblogs.com/blog/478956/201911/478956-20191108141819363-1002518758.png)
3 实际效果
![](https://img2018.cnblogs.com/blog/478956/201911/478956-20191108141829988-177379718.png)