如何在Intellij中为Live模板添加自定义表达式函数 [英] How can i add custom expression functions for Live templates in Intellij
问题描述
如何在Idea Intellij中为实时模板添加新的自定义函数。
How can add new custom functions for Live Templates in Idea Intellij.
例如,我需要一个自定义函数,可以将实时模板变量从Camel Case转换为Spaced 。
,即在变量的实时模板中必须在多个位置插入&没有空格。
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.
例如。 MyVar和我的Var。所以我想插入一个表达式将'MyVar'转换为'My Var'。
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.
谢谢。
推荐答案
OpenAPI提供实时模板功能。可以创建IntelliJ IDEA插件,添加更多功能。
There is OpenAPI for providing Live Template functions. One can create IntelliJ IDEA plug-in that will add more functions.
参见 Macro 抽象类。插件应该定义扩展点,如下所示:
See the Macro abstract class. Plug-in should define extension point, like this one:
<liveTemplateMacro implementation="com.intellij.codeInsight.template.macro.CapitalizeMacro"/>
搜索 IntelliJ IDEA社区示例实现的代码库。
Search IntelliJ IDEA Community code base for sample implementations.
这篇关于如何在Intellij中为Live模板添加自定义表达式函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!