V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
LucasLee92
V2EX  ›  Java

关于 idea live template 的求助

  •  
  •   LucasLee92 · 2017-12-15 15:13:29 +08:00 · 2687 次点击
    这是一个创建于 2314 天前的主题,其中的信息可能已经有所发展或是发生改变。

    现在无聊想写些模版方便以后自己开发偷懒,然后在写一个模版的时候卡住了,也找了官方模版方法再看,没啥帮助,希望会的兄弟帮忙给个提示什么的也好

    想实现的效果:

    • Integer i = 11;
    • i.ive ===> Integer.valueOf(光标在此).equal(i)
    5 条回复    2017-12-25 17:01:03 +08:00
    mosliu
        1
    mosliu  
       2017-12-15 15:28:35 +08:00
    把光标在此 替换成 $END$
    好多例子里面有啊。。。。
    ZSeptember
        2
    ZSeptember  
       2017-12-15 15:31:07 +08:00   ❤️ 1
    你这个叫 Postfix Completion 不能自定义
    LucasLee92
        3
    LucasLee92  
    OP
       2017-12-15 15:34:21 +08:00
    算是写出了一个基本的`Integer.valueOf($END$).equals($PARAM$)`,PARAM 对应的 complete()方法,但是这么写的话,用`i.ive`是调不出我的模版的,难道像`String s = "1"; s.sout ==> System.out.println(s);`这种模版是不能用 live template 实现的吗?
    LucasLee92
        4
    LucasLee92  
    OP
       2017-12-15 15:34:32 +08:00
    YzSama
        5
    YzSama  
       2017-12-25 17:01:03 +08:00
    @LucasLee92 #3
    不能。
    我之前也关注过,IDEA 只能添加 Live template 设定。
    Postfix Completion 没有办法添加设定。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5477 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 51ms · UTC 09:14 · PVG 17:14 · LAX 02:14 · JFK 05:14
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.