Idea 方法註釋模版

打開idea 「setting」-> 選擇「Live Templates」自定義模版

點擊 「 + 」 -> 選擇「Templates Group」建立模板組

給自定義模版組取個名字 點擊肯定建立

選中自定義的模版組 點擊「 + 」選擇「Live Template」建立自定義模版

配置自定義模版

  • Abbreviation 填:*app

  • Description 隨便填什麼 這裏以 add comment for method 爲例ide

  • Template text:idea

    *
    		 * @Author: 本身取名 
    		 * @Description: 
    		 * @Date: $DATE$ $TIME$
    		 * $VAR1$
    		 $params$* @Return $returns$ 
    		 */

  • 如有 No applicable contexts yet. 警告 點擊Define 選擇一門語言(好比Java) 或全選(Everywhere) 生成模版; 若沒有警告 忽略此步.net

  • 點擊 Edit variables 進行編輯
    VAR1 代碼:code

    groovyScript("def result='';def params=\"${_1}\".replaceAll('[\\\\[|\\\\]|\\\\s]','').split(',').toList();for(i = 0; i < params.size(); i++) {if(i!=0)result+= ' * ';  result+='[@Param](https://my.oschina.net/u/2303379) ' + params[i] + ((i < (params.size() - 1)) ? '\\n' + '' : '');};return result", methodParameters())

效果圖

相關文章
相關標籤/搜索