Home > Blockchain >  How to format simple if statements to one line in Eclipse
How to format simple if statements to one line in Eclipse

Time:02-01

How can I configure Eclipse formatter to format simple if statement like

result = validate(object);
if (result != 'OK') {
  return result;
}

to

result = validate(object);
if (result != 'OK') { return result; }

In other words: Keep If-statements including one statement in one line if possible. I checked New Lines > In control statements > 'if else' > Keep simple 'if' on one line, but somehow it's not simple enough though.

CodePudding user response:

Set New Lines > Keep braced code on one line > 'if then' statement body to If at most one item for that.

  •  Tags:  
  • Related