'if' statements formatting
Hi
I can't find how to stop IDEA from putting 'if' statement body on the same line. For instance
if (bla)
foo();
becomes
if (bla) foo();
after reformatting.
Is there any way to make it split it into 2 lines?
Thanks
Please sign in to leave a comment.
Hi Konstantin,
Please enable the following code style setting - 'Keep when reformatting - Line breaks'.
Denis
Thanks, but this is a too general setting that affects lots of stuff. Besides, it it simply keeps my own formatting an doesn't make IDEA reformat
as
I guess there must be a separate setting like 'insert newlines after if/else, do, while, for'
Sure, this one - 'Wrapping and Braces - Keep when reformatting - Control statements in one line'.
Denis
Thanks. I think I was misleaded by the section name and didn't check all the options inside it. "Keep while reformatting" suggests that no action will be taken by reformatter in specific situations, while in this case it actually splits a statement in 2 lines.
On Wed, 07 Sep 2011 02:37:40 MSD, Konstantin Sobolev <k_o_s@mail.ru>
wrote, quoted or indirectly quoted someone who said :
>Is there any way to make it split it into 2 lines?
>Thanks
see File / Settings / code Style / wrapping and braces
--
Roedy Green Canadian Mind Products
http://mindprod.com
The modern conservative is engaged in one of man's oldest exercises in moral philosophy; that is,
the search for a superior moral justification for selfishness.
~ John Kenneth Galbraith (born: 1908-10-15 died: 2006-04-29 at age: 97)