1

I like to wrap long chained methods in my code when i format it. But i don't like method chains that are small (ex: 3 methods or less) to be wrapped. So i want this to be wrapped:

OkHttpClient client = new OkHttpClient().newBuilder().connectTimeout(15, TimeUnit.SECONDS).writeTimeout(15, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).build();

but NOT this

String[] str = object.toString().split(":");

Is there anyway in Intellij to can control how long the chain has to be in order for it to be wrapped?

DarkMental
  • 482
  • 7
  • 26
  • As far as I know there is not a way to control this by number of chained calls. There is an option in the settings (Editor/Code style/Java/Wrapping and Braces/Chained method calls) which can be set to _Wrap if long_. IntelliJ determines what is "long" by Right margin (Settings/Editor/Code style). So if you have right margin set to 80 characters and the chained method call exceeds this length, it will be wrapped. – Bohuslav Burghardt Dec 31 '16 at 17:11

1 Answers1

2

This is NOT possible on the latest version of Intellij Idea, however you may want to submit a feature request here.

Rafat Mahmoud
  • 130
  • 3
  • 16