Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Join lines in Eclipse without whitespace

For example, joining these two lines with the keyboard shortcut CTRL+J in Eclipse results in the following:

something().somethingElse()
    .yetAnotherThing();

// Joining the above two lines results in this:
something().somethingElse() .yetAnotherThing();

Is there a way to join those lines so it results in this:

// Notice there is no excess whitespace
something().somethingElse().yetAnotherThing();
like image 460
Steven Avatar asked Sep 29 '22 22:09

Steven


1 Answers

As far as the specific "join lines" command introduced with Eclipse 3.3 which in my case is bound to Ctrl+Alt+J, I think we are currently stuck with the addition of the space. It is a known bug.

You might throw the dice and instead select the lines and try the format command (for me it is bound to Shift+Ctrl+F) to see if that behaves any better.

Selecting the lines ahead of requesting the format should limit the scope of formatting to the selected lines.

like image 145
unigeek Avatar answered Oct 05 '22 08:10

unigeek