Live Template Expression: toLowerCase
I need to convert a Live Template variable (that is its value) to lower-case.
e.g.
user input vor VAR1: thisIsMyValue
value of VAR2: thisismyvalue
I need both values in the Live Template.
In "Edit Variables" I have built-in expressions such as capitalize, is there any way to call a custom function, or a standard JavaScript function?
Appreciate any input!
mberrie
Attachment(s):
screenshot.png
Please sign in to leave a comment.
Hello!
there is a decapitalize(<name>) function - see http://www.jetbrains.com/webstorm/webhelp/edit-template-variables-dialog.html
Custom functions are supported in IntellijIdea via groovy script macro, but this feature is not a part of WebStorm/PHPStorm
Is it still the case in 2019 that PHPStorm offers a poor, limited subset of string manipulation functions for Live Templates and no way to extend it?
Please see https://www.jetbrains.com/help/phpstorm/2019.2/edit-template-variables-dialog.html#predefined_functions for the full list of predefined functions.
groovyScript()
is also supported; see http://blog.nidi.guru/tech/java/2015/04/05/intellij-live-template/ and http://bartololeo.blogspot.com/2014/01/idea-12-how-to-write-live-template-with.html for some hints on using itYou can also try developing your own functions as plugins. See https://intellij-support.jetbrains.com/hc/en-us/community/posts/206201699-create-a-new-expression-for-a-live-template-for-actionscript for more info.
Existing live template functions implementations can be found at https://github.com/JetBrains/intellij-community/tree/master/platform/lang-impl/src/com/intellij/codeInsight/template/macro
This will do exactly what you need.