Shota Shota - 18 days ago 6
Javascript Question

How to chain predefined functions in Webstorm live template variables

I am trying to give a name to a React component, based on a file name. E.g. if file name is test-comp.js component should be named as TestComp.

Thus I want to call built in functions of live templates this way:

capitalize(camelCase(fileNameWithoutExtension()))


However it does not work. I also tried doing it from 'Edit variables' window, but looks like I can only add one function expression there. Any suggestions?

Answer

This has to be done in Edit Template Variables window; you can enter as many functions as you like there (but, of course, you have to type them - you can't enter complex expressions by selecting function from dropdown):

enter image description here