问题
How can add new custom functions for Live Templates in Idea Intellij.
For example i need a custom function which can convert a live template variable from Camel Case to Spaced. i.e in Live Template on variable has to be inserted at multiple places with & without space.
Eg. "MyVar" and "My Var". So i want to insert an expression to convert 'MyVar' to 'My Var'.
No expression available by default can be used for this.
Thanks.
回答1:
There is OpenAPI for providing Live Template functions. One can create IntelliJ IDEA plug-in that will add more functions.
See the Macro abstract class. Plug-in should define extension point, like this one:
<liveTemplateMacro implementation="com.intellij.codeInsight.template.macro.CapitalizeMacro"/>
Search IntelliJ IDEA Community code base for sample implementations.
来源:https://stackoverflow.com/questions/12156205/how-can-i-add-custom-expression-functions-for-live-templates-in-intellij