I'm trying the Eclipse Auto Formatter, but I cannot find a proper options to format according to my liking.
When I have a line like this:
MyLongNameClass myLongNameObject = otherObject.callAVeryLongMethodWithParameters(param1, param2, param3)
Eclipse auto formatter wraps it this way:
MyLongNameClass myLongNameObject = otherObject
.callAVeryLongMethodWithParameters(param1, param2, param3)
I'd rather like to have this result:
MyLongNameClass myLongNameObject =
otherObject.callAVeryLongMethodWithParameters(
param1, param2, param3)
Keeping the object and the method accessor on the same line, and avoiding starting a new line with '.'. Is this possible? Is there an option for this?
I'm not sure if you can really do what you wanted, but this might get you close:
In eclipse Mars:
Go to Window -> Preferences -> Java -> Code Style -> Formatter
Create your own profile based on one of the built-ins using the New... button. By default this will take you into the editing window. If you already have a formatter set up that you want to change, select it and use the Edit... button.
In the profile editing window do the following:
Function Calls -> Qualified invocations. Settings for qualified invocations area select Do not wrap. Function Calls -> ArgumentsWrap first element, others where necessary in the argument settings then select Indent by one.You can test these settings by adjusting the line width in the preview window.
I know this is a late submission, but I hope it helps someone else who searches for this same feature.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With