Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
417 views
in Technique[技术] by (71.8m points)

IDEA中的.var是如何实现的?我能自己增加这样的快捷键?

希望能实现这样的效果:

public void example(String example){
    example.nonNull
}

-->tab-->

public void example(String example){
    Objects.requireNonNull(exmaple,"example");
}

我在 settings -- live templates 中没有找到 .var 这个东西。找到 .sout 但好像不能做到 var.sout --> System.out.println(var) ,只能做到先 sout --> System.out.println() 然后再在括号内输入 var

谢谢


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

可以。在下面这里定义
File | Settings | Editor | General | Postfix Completion

变量 $EXPR$ 就是表达式。

图片.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...