News

Mutable/immutable collections prefix convention support

As described here we should prefer the following code style for mutable and immutable collection names:

Scala plugin for IntelliJ IDEA (nightly builds) now supports this code style by default.

First of all, it brings useful code inspection, helping to migrate from different code style:

Second is class name completion and auto-import features. They both support this code style. And everywhere, where you need to import something mutable, it will be imported with such prefix according to this code style.

Third thing is that basic completion considers “import scala.collection.mutable” import as placeholder import. So there is no necessity to use class name completion everytime, when you want to use mutable completion.

And it’s not all. The last thing is that it works not only for collections. You can define any set of classes, which should support such code style.

Check “Settings -> Scala -> Imports -> Classes to use only with prefix”. Here you can add your own classes (if you have some other name clashes), or you can remove current classes (in case if you don’t want to use this code style for mutable colletions).