Problem with LiveTemplates -> capitalize

Hi Guys,

/* @var $$$varname$_service $ServiceName$Service */
$$$varname$_service = ServiceFactory::get('$ServiceName$');

This is my Live Template, fully working.

i have to expand it -> then $ServiceName$ = "Movie" -> Enter -> $varname$ = "movie"


/* @var $movie_service MovieService */
$movie_service = ServiceFactory::get('Movie');

So, movie -> Movie, i just want to have 1 var to fill, which is capitalized on the right side, but i don't get it :)

Maybe you can help me.

Best regards Oskar

Comment actions Permalink

Hi there,

1) File | Settings | Live Templates
2) Find this template and click "Edit"
3) Click "Edit variables" button (big button under Template text)
4) Select "ServiceName" variable row (should be 2nd row, unless you have rearranged them) and in "Expression" column enter this text: capitalize(varname)
5) OK, OK and test it

Comment actions Permalink

HI, this works still fine, i decided do "decapitalize" the ServiceName

/* @var $$$varname$_service $ServiceName$Service */ $$$varname$_service = ServiceFactory::get('$ServiceName$');

$varname is instantly changed to "movie", but after Entering the ServiceName-Var -> Enter -> $varname will be selected, but i dont want to select it anymore, because the varname is finished!

What to do ? oO

Thank you for your support!

best regards Oskar

Comment actions Permalink

Sorry, for doublepost!

Edit, ok, i have to change the order and the skip if defined to varname!


Comment actions Permalink

On the "Edit Variables" screen -- You may need to rearrange the variables on that screen -- move 1st down as it works absolutely fine here -- varname is filled first and only then ServiceName.

Ah, you already have figured it out yourself :)


Please sign in to leave a comment.