2022 UPDATE
There is still no answer to what the OP asked - configure IntelliJ to "automatically split those long strings". The most upvoted answer does not work.
There is only one way (it's manual) to solve this problem short of someone writing a plugin. This method is guaranteed to work regardless of any other settings and provides 100% control of formatting of any code segment, not just those with long lines of strings.
Go to Settings Editor | Code Style | Formatter
and enable the formatter on/off markers. Format the code fragment any way you want and surround it with the off/on phrases in code comments.
My example code segment:
System.out.println("This is a long line of text that includes " + variables() + " and " + some.otherStuff().toString() + ". But don't count on " + this.IDE().toName() + " to format it in " + anIntelligent() + " way. " + this.IDE().toName() + " should add a " + plusSign.Option() + " for long strings like this.");
RESULT 1 With settings as described in @mkierc's answer with a hard wrap at 80 per OP:
System.out.println(
"This is a long line of text that includes " + variables() + " in " +
"it and " + some.otherStuff()
.toString() + ". But don't count on " + this.IDE()
.toName() + " to format it in " + anIntelligent() + " way. " + this.IDE()
.toName() + " should add a " + plusSign.Option() + " for long strings like this.");
I don't know how this could be worse. The hard wrap was not honored after the second line and the ending semi-colon is at column 300! Honestly, I can't imagine what algorithm led to this mess. My son at 10 years old could do better...
RESULT 2 Formatted manually, margin at 80, and using formatter on/off markers:
//@formatter:off
System.out.println("This is a long line of text that includes "
+ variables() + " in it and " + some.otherStuff().toString()
+ ". But don't count on " + this.IDE().toName()
+ " to format it in " + anIntelligent() + " way. "
+ this.IDE().toName() + " should add a " + plusSign.Option()
+ " for long strings like this.");
//@formatter:on
It's possible that Result 1 can be improved with other settings. I tried a few seemingly relevant options and combinations thereof. None significantly changed the results.
+
sign. For example it possible to configure Intellin to wrap code line that more than 80 symbols, I need something similar with too long strings.