Prevent intellij from formatting strings
Answered
Hi!
I have this java code.
String str = "a"
+ "b"
+ "c";When I format code with Ctrl + Alt + L
It becomes just
String str = "a" + "b" + "c";How can I prevent this?
I want to have pretty printed json in string and that is why I don't want intellij to mess it up.
Please sign in to leave a comment.
See if it helps to enable the option to preserve existing line breaks in the settings:
Thanks it helped.
I read this yesterday https://www.jetbrains.com/help/idea/reformat-and-rearrange-code.html#reformat_module_directory but couldn't figure out why Do not keep line breaks wasn't showing for me. After enabling what you suggested I started to see Do not keep line breaks. Now I see it says “This option overrides the Keep when reformatting | Line breaks setting.” but I think this hint is kinda too cryptic. Would be good if your screenshot could be added there somehow.