强制IntelliJ中的代码格式化程序来连接行 [英] Force code formatter in IntelliJ to join lines
本文介绍了强制IntelliJ中的代码格式化程序来连接行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正试图强制IntelliJ按照Eclipse的方式重新格式化代码。
当我将线宽设置为例如120个字符我希望IDE加入被分解为多行的行(例如因为行宽设置为80个字符)。
I'm trying to force IntelliJ to reformat the code the way Eclipse does it. When I set a line width to e.g. 120 chars I would like IDE to join line that were broken up to multiple lines (e.g. because the line width was set to 80 chars).
我想从这里开始:
int a = 1
+ 2;
到这里:
int a = 1 + 2
是否可以在IntelliJ中使用?我正在寻找格式化程序中的适当设置但无法找到它。有人可以告诉我在哪里可以找到它吗?
Is it possible in IntelliJ? I'm looking for the appropriate setting in the formatter but cannot find it. Could someone tell me where I can find it?
推荐答案
如果我去的话,这适用于intellij 8:
This works for me in intellij 8 if i go to:
File -> Settings -> Code Style -> Wrapping -> Binary operations -> set to: 'Wrap if long' or 'Do not wrap'
然后 CTRL - ALT - L 重新格式化代码
Then CTRL-ALT-L to reformat the code
这篇关于强制IntelliJ中的代码格式化程序来连接行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文