Formatter removes space inside curly braces?

At the moment, I can't figure out how to make the code formatting settings leave space inside curly braces, such as lambdas. So code I would like to look like:

items foreach { x =>
  frob(x)
}

instead looks like:

items foreach {x =>
  frob(x)
}

I've looked all over, so I'm assuming this feature is not currently implemented. Would it be realistic for an outsider (like, say, me) to submit a patch for this? Or will it be really difficult and I should not even bother taking a look? On the face of it, it seems like a Spaces -> Within -> Braces setting is an obvious move, which makes me feel like it may be unimplemented for unobvious and hard-to-change reasons.

Thanks for your time!

Luke

4 comments
Comment actions Permalink

Such setting enabled by default was pushed yesterday. Actually it was a patch from Sam Pullara. So for any other problems you can try to fix them by yourself (if it's not related to type system, it's quite easy).

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

Ok, so I looked at the source a little. The relevant file is: lang/formatting/processors/ScalaSpacingProcessor.scala. At line 953 it handles processing before left brace. I think I could just add two more sections after that to handle processing after the left brace and before the right brace. Then I'd have to add something to the "settings" object and hook it up to the gui. So, doesn't look impossible but I can't even get it to build yet so a patch might take a while.

Does this sound like it would work?

0
Comment actions Permalink

Oh sorry, I posted again before I saw your message. Thanks for the good news! I'll grab the latest version from the repository. Funny timing...

Thanks again,
Luke

0
Comment actions Permalink

You should try nightly build: http://confluence.jetbrains.net/display/SCA/Scala+Plugin+Nightly+Builds+for+Nika
It's not updated to plugin repository yet.

Best regards,
Alexander Podkhalyuzin.

0

Please sign in to leave a comment.