进入设置LiveTemplate,在kotlin模板里面添加一个模板,名字可以叫loge
TemplateText中输入:
Log.e(TAG,"$methodname$ $args$");
点击右侧EditVariables
methodname kotlinFunctionName()
args groovyScript("def sb = new StringBuilder(); for(String s in _1){ sb.append(s+':$'+s+' ') } ;return sb.toString(); ",functionParameters()):
点击OK
然后在代码里打入loge然后补全,现实如下:
override fun onSectionDecreased(decDuration:Long, totalDuration:Long, sectionCount:Int) { Log.e(TAG,"onSectionDecreased decDuration:$decDuration totalDuration:$totalDuration sectionCount:$sectionCount "); }
对于有很多参数的方法会很有用
参考:
https://www.jetbrains.com/help/idea/2016.3/live-template-variables.html#predefined_functions