例如,使用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();
至于Eclipse 3.3引入的特定“连接线”命令,在我的情况下绑定到Ctrl + Alt + J,我认为我们目前仍然坚持添加空间。这是一个known bug。
您可能会掷骰子而是选择线条并尝试格式化命令(对我而言,它绑定到Shift + Ctrl + F)以查看它是否表现得更好。
在请求格式之前选择行应该将格式化范围限制为所选行。