This Question is Possibly Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
1 Replies Last post: Oct 18, 2013 7:59 PM by Alexander Chernikov  
Craig Street Newbie 7 posts since
Apr 18, 2008
Currently Being Moderated

Oct 17, 2013 6:27 AM

Live Template Variables - methodParameters() expansion problem

Hi

 

I have created a new live template with variables as per

http://www.jetbrains.com/idea/webhelp/edit-template-variables-dialog.html

 

When I use a live template as follows

Preconditions.checkNotNullArgument($parameter$, "$parameter$");

 

where $parameter$ is defined as methodParameters()

 

When used within a method, it expands as follows

public final SERVERTHEN replyWith(Object response) {

     Preconditions.checkNotNullArgument([response], "[response]");

...
}

 

Is there a reason why the square brackets are included in the expansion? In each case I need to remove them from the parameter name to get the statement to compile?

 

I am running 12.1.1 Ultimate edition.

 

Thank you.

Alexander Chernikov JetBrains 1,177 posts since
Jan 11, 2007
Currently Being Moderated
Oct 18, 2013 7:59 PM in response to: Craig Street
Re: Live Template Variables - methodParameters() expansion problem

Hello.

 

Looks like that's done intentionally: since we can't predict what exactly user want to do with many parameters, he has to write some custom processor.

 

Take a look at bundled *soutp* template: it uses methodParameters(), maybe that idea is good for you.

 

Regards,

Alexander.

More Like This

  • Retrieving data ...