Scala logo

Scala Plugin

Scala Plugin for IntelliJ IDEA and Android Studio


Of braces and parentheses

In Scala, you may often want to replace braces with parentheses and vice versa.

For example, imagine that you decided to use curly braces in the following statement:

It looks like not a big deal, but in practice it takes a lot of key presses, cursor positioning, and a fight with the automatic brace balancing. That’s now a thing of the past.

Just invoke an intention (Ctrl + Alt + Enter):

… and it’s done:

It’s possible to run it the other way:


Besides sequence comprehensions, there are similar intentions for converting method call arguments, like the following:

Run the intention:

The result:

Now let’s transform the braces back to parentheses:

Here they are: