在IntelliJ实时模板中自动生成随机长度

tra*_*ega 4 intellij-idea live-templates auto-generate

如何在IntelliJ中的实时模板中自动生成任意数字(长整数)?

例:

public static final long uid = $randomLong$;
Run Code Online (Sandbox Code Playgroud)

其中randomLong替换为随机长值.我尝试将以下内容添加为实时模板定义中变量的表达式,但模板输出时不会生成任何内容.

new Random().nextLong()
Run Code Online (Sandbox Code Playgroud)

我想要实现的非常类似于IDEA代码检查器为序列化版本UID字段生成但具有实时模板的内容.

Pet*_*mov 6

请尝试添加groovyScript("new Random().nextLong()")为变量表达式.