1

Eclipse format my code this way, means it puts the parameters one different lines:

nearByLocationsArray = getAddress(      currentLocation.getLatitude(),
                        currentLocation.getLongitude(), 10).toArray(
                        new String[nearbyLocations.size()]);
nearbyLocations = gCoder.getFromLocation(latitude, longitude,
                                maxResults);

However, I seriously don’t like that I want to keep it simple like this in one line:

nearByLocationsArray = getAddress(currentLocation.getLatitude(),currentLocation.getLongitude(), 10).toArray(new String[nearbyLocations.size()]);
nearbyLocations = gCoder.getFromLocation(latitude, longitude,maxResults);

I tried looking for the appropriate option in the formatting settings but couldn't find, can anyone please help me in setting this up, please.

Maven
  • 14,587
  • 42
  • 113
  • 174

2 Answers2

2

As of my knowledge don't use Ctrl+Shift+F for formatting the code which gives every parameter in new line if you want to make it in single line please check the following step,

simple select the lines which you want to show it in single line and user shortcut key

Ctrl+Alt+J

Hope it helps you

Sainath Patwary karnate
  • 3,165
  • 1
  • 16
  • 18
1

The answer to your question is to modify the maximum line length for the auto formatting. This info was already covered here:

Maximum Line Length of Auto Formatting of Eclipse

After you make a profile and increase the line wrapping, you can Ctrl+Shft+F to your heart's content.

Community
  • 1
  • 1
N8sBug
  • 342
  • 3
  • 9
  • For the record, when I do `Ctrl+Shift+F` it does this, and the line count is under the default limit of 80. So that is not. – Zaxxon Oct 21 '21 at 21:05