Any way to configure eclipse to only wrap if statements in braces if it is multiple lines, and leave alone single line statements? e.g.
if (x == y) z();
if (x == y){
z();
}
Any way to configure eclipse to only wrap if statements in braces if it is multiple lines, and leave alone single line statements? e.g.
if (x == y) z();
if (x == y){
z();
}
Use can use //formatter:off
and //formatter:on
tags to switch on or switch off formatting in a given range of code lines.
Refer this post: How to use eclipse's code formatter to remove new lines after 'case'?
How would it know? If you have a default of always using braces for multiple or single, you will avoid errors of putting in code that is supposed to be part of the if statement but ends up not.