Cherish your packages
After the introduction of chained package clauses in Scala 2.8 we have the ability to rewrite “package foo.bar” as “package foo; package bar” in order to automatically import all “foo” package entities (so, these two declarations are not equivalent).
Scala plugin used to flatten packagings structure on moving or copying classes, but now there’s a better algorithm, that preserves desired package chaining. Let’s consider the following example:
If we move that class to “foo.other.name” package we will get the following:
In addition to explicit package chaining we can specify a base package in a module facet:
After that, all packages that start with the base prefix will be chained automatically.
Moreover, there’s a warning about the lack of chaining at the base level:
We can use a build-in “quick fix” to split that declaration automatically:
We can also split and join such lines using Smart Enter (Ctrl + Shift + Enter) and Join Lines (Ctrl + Shift + J) actions. Here’s how it works:
After Ctrl + Shift + Enter we will get:
Then we may join the packages again with Ctrl + Shift + J:
P.S. Thanks to Jason Zaugg for some of these features
IntelliJ Scala Plugin 2023.3 Is Out!
Scala 3 As usual, the new release focused much on improving the Scala 3 support. Especially enums received much attention. The Scala plugin now recognizes that enums cannot be extended and highlights such attempts; annotations and modifiers are now propagated correctly to generated symbols; type…
IntelliJScala @ Scala Days 2023 Madrid
On September 12 – 14, the Scala Plugin team was in Madrid for the Scala Days conference. JetBrains was a Gold Sponsor for the event and we are very proud of it. We came to Madrid with a booth, merchandise, and a talk about the IntelliJ Scala Plugin. The Scala Plugin has seen a lot of improvements…
IntelliJ Scala Plugin 2023.2 Is Out!
Better Scala 3 Support IntelliJ IDEA 2023.2 brings enhanced Scala 3 support, with a focus on providing a streamlined development experience. Notable improvements include fixes for Scala 3 enum highlighting, navigation to enum definitions, and the correct resolution of enum cases in various contex…
IntelliJ Scala Plugin 2023.1 Is Out!
Improved support for braceless Scala syntax IntelliJ IDEA can now desugar braceless Scala code properly, and it handles refactorings where the “fewer braces” feature is used. It also supports braceless syntax in worksheets and correctly interprets indentation when you move extensions methods up a…