IntelliJ IDEA空构造函数/方法代码样式 [英] IntelliJ IDEA empty constructor/method code style
本文介绍了IntelliJ IDEA空构造函数/方法代码样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何为Java调整InlliJ IDEA 14代码样式,使其在打开后立即关闭空构造函数/方法的大括号。
How to tweak InlliJ IDEA 14 code style for Java, to make it keep closing brace of empty constructor/method right after opening one.
E。 G。 :
class A {
private A() {}
public void b() {}
}
推荐答案
转到设置/代码样式/ Java /环绕和大括号并选择以下选项:
- 重新格式化$时保留b $ b
- 一行中的简单块
- 一行中的简单方法
- 一行中的简单类
在重新格式化代码时,这将保持此类代码不变:
That will keep code like this untouched while reformatting your code:
if(true) {} public void foo() {} public class Bar {}
我在IntelliJ 13.1.5上对此进行了测试,但希望它在14上也会以同样的方式运行。
I tested this on IntelliJ 13.1.5, but hopefully it will work the same way on 14 too.
这篇关于IntelliJ IDEA空构造函数/方法代码样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文