Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn off Scala auto-completion of function with Unit return type in IntelliJ IDEA?

IntelliJ IDEA Scala plugin has a feature for automatically adding :Unit to the end of unit-returning functions. So, for example, if I'm writing a side-effecting function foo:

def foo() {}

when I hit Enter while the cursor is between the braces, I'll get the following:

def foo():Unit = {

}

I, personally, prefer the following instead:

def foo() {

}

So, how do I turn this feature off?

like image 368
Andrey Avatar asked Aug 24 '14 02:08

Andrey


1 Answers

tldr;
Preferences > Code Style > Scala > Other > Uncheck: Enforce procedure syntax [blah blah blah]
  1. Open IntelliJ Preferences dialog
  2. In the right panel expand Code Style
  3. Select Scala
  4. Click on tab titled Other
  5. Uncheck Enforce procedure syntax for methods with Unit return type
like image 58
Andrey Avatar answered Sep 28 '22 12:09

Andrey