Remove curly braces in for ... yield expression?

Hi there,

How can I remove the curly braces in my for .. yield expressions?  If I type in this:

for (x <- list) yield x * 2

The formatter will change it to:

for (x <- list) yield {
   x*2
}

At that point I can move everything back up to the same line like this, which will remain unperturbed during subsequent formats:

for (x <- list) yield { x * 2}

But I can't find out how to get rid of the curly braces.  I toggled several of the options in code style->scala->for statements, but they didn't seem to change it.

Thanks!
Sam

0
Avatar
Permanently deleted user

Settings->Code Style->Wrapping and Braces

Find 'for()' statement, change 'Force braces' to 'Do not force' or 'when multiline'.

dave
<><

0
Avatar
Permanently deleted user

I tried setting Settings->Code Style->Scala->Wrapping and Braces->For() statement->force braces to "do not force" and that didn't fix the problem.  I also tried setting Settings->Code Style->Java->Wrapping and Braces->For() statement->force braces to "do not force" and that also didn't fix the problem.  

I also noticed that this problem is only in "for .. yield" expressions.  "for (x <- 0 to 10) print(x)" formats properly without adding braces on new lines.  So perhaps the problem is with the yield.

Anything else I could try?

Thanks!
Sam

0

It was a bug in settings in IDEA 11 plugin. I just fixed it. Thank you for report.

Best regards,
Alexander Podkhalyuzin.

0

请先登录再写评论。