開發技巧--idea自動生成方法註釋(含引數及返回值)
阿新 • • 發佈:2021-07-12
- File->settings->Editor->Live Templates
-
點選**+**->選擇template group ,然後輸入group的name,如annotation。
然後,選中剛才建立的annotation,然後再次點選右側的綠色+,這次選擇的是第一個1. Live Template。取名為*。-
Template text配置模板
-
* * * $VAR1$ $params$* @return $returns$ * @author 張紫韓 * @creed: Talk is cheap,show me the code
- 配置variables,點選 Edit variables
- 其中VAR1對應的指令碼如下:
groovyScript(" def result=''; def params=\"${_1}\".replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList(); for(i = 0; i < params.size(); i++) { if(i!=0)result+= ' * '; result
- 其中VAR1對應的指令碼如下:
-
注意要勾選所需檔案格式
-
輸入 /** ,按 tab 成功