Idea Live Template to Log Method Args

前端 未结 3 1475
隐瞒了意图╮
隐瞒了意图╮ 2021-02-15 00:04

I would like to be able to create a live template in Jetbrain\'s Idea that will log the method\'s arguments. Let\'s call it \"larg\". It would work like:

public          


        
相关标签:
3条回答
  • 2021-02-15 00:32

    This is now 6 years late, but I found a well described solution to this. (I don't have any soutp templates in my templates) http://artfulonline.blogspot.com.au/2014/03/quick-logging-with-intellij-live.html

    0 讨论(0)
  • 2021-02-15 00:38

    I'm 4 years late, but the predefined template soutp pretty much does this using a groovyscript variable.

    Here's the groovy script that does what you're looking for

    groovyScript("'\"' + _1.collect { it + ' = [\" + ' + it + ' + \"]'}.join(', ') + '\"'", methodParameters())
    
    0 讨论(0)
  • 2021-02-15 00:50

    Looks like it is not currently possible with a live template.

    From the Jetbrain's forum:

    There is no predefined live template function to do this for you automatically.
    You can write a plugin that would provide such a function.
    
    0 讨论(0)
提交回复
热议问题