由于重新安装idea,所以需要重新设置一下快捷方式
其中注释的快捷方式设置记录如下:
设置注解快捷键
使用
在需要自动生成多行注释的代码处使用设置的快捷键
设置类注释自动生成
使用
创建类时自动生成类注释
方法注释生成
其中第 8 步中的 Template text 为:
** * $VAR1$ $Params$ * @Return: $returns$ * @Author: xnz * @Date: $date$ $time$ * @Creed: Talk is cheap,show me the code */
其中第十步中的VAR1的 Expression 为:
groovyScript(" def result=''; def params=\"${_1}\".replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList(); for(i = 0; i < params.size(); i++) { if(i!=0)result+= ' * '; result+='@param ' + params[i] + ((i < (params.size() - 1)) ? '\\n' + '\\t' : ''); }; return result", methodParameters())
使用
直接输入
/*
,然后按 Tab 键即可
参考:
IntelliJ IDEA添加JavaDOC注释 方法 快捷键 https://www.cnblogs.com/linkenpark/p/11403265.html
idea自动生成方法注释(含参数及返回值) https://blog.csdn.net/yuruixin_china/article/details/80933835
为idea设置生成类时自动添加文档注释的模板 https://blog.csdn.net/f2764052703/article/details/95311990