Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Infix method call in IntelliJ IDEA

Whenever I am trying to use infix method call, IntelliJ IDEA adds parentheses after method name.

For example:

val xs = List(1,2,3)

If I type xs contai and then press Enter, IntelliJ IDEA completes this expression as follows:

xs contains()

but I expect without parentheses:

xs contains 

Is there an option to disable adding parentheses for infix method call?

I use IntelliJ IDEA 12.1 with Scala plugin 0.7.213.

[UPDATED]

The method I want to call is

def contains(elem: Any): Boolean

from scala.collection.immutable.List

The complete expression is xs contains 1

like image 796
Denis A. Avatar asked Dec 21 '25 15:12

Denis A.


1 Answers

There is no such option, and there is no plans to add it in the future yet. Reason is that it's not infix call, what you want, it's postfix call, and after any postfix call you have to use semicolon or extra line feed. Both things are pretty ugly, that's why in Scala 2.10 you will get warning for postfix calls usages.

like image 138
Alefas Avatar answered Dec 23 '25 08:12

Alefas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!