I have recently switched from Netbeans to PhpStorm and I am missing this feature.
Is there a way to get PhPStorm to automatically fill out the previously declared variable in a Live Template?
I would like to be able to place the cursor after a line like this
$stuff = $this->getStuff();
And have a template that automatically knows that I would like to use the $stuff variable like so
if (!empty($VariableBestGuess$))
{
print_r($VariableBestGuess$);
}
So it automatically fills out this code
if (!empty($stuff))
{
print_r($stuff);
}
I have tried clicking "Edit Variable" on the $Variable$ and set the Expression to "phpSuggestVariableName()" but it does not seem to do anything.
The documentation says "jsSuggestVariableName" which I am not sure if is intended.
https://www.jetbrains.com/phpstorm/help/live-template-variables.html
UPDATE: I have submitted this as a feature request: http://plugins.jetbrains.com/wishlist/show?pr=&wid=526
there is no such function. You can use complete()
to have PHPStorm invoke the completion to choose from when applying the template, or use clipboard()
and make sure to copy your variable name prior to expanding the template