例如,在Eclipse中使用键盘快捷键 CTRL + J 连接这两行会产生以下结果:
something().somethingElse()
.yetAnotherThing();
// Joining the above two lines results in this:
something().somethingElse() .yetAnotherThing();
有没有办法加入这些行,所以它导致了这个:
// Notice there is no excess whitespace
something().somethingElse().yetAnotherThing();
答案 0 :(得分:4)
具体的"加入线"用Eclipse 3.3引入的命令,在我的情况下绑定到 Ctrl + Alt + J ,我想我们目前仍然坚持添加空间。这是known bug。
你可能会掷骰子而是选择线条并尝试格式化命令(对我而言,它绑定到 Shift + Ctrl + F )看看它是否表现得更好。
在请求格式之前选择行应该将格式的范围限制为选定的行。