IntelliJ Scala Plugin 2021.3 Is Out!
This release brings more improvements to Scala 3 support. There are also several new features to help with day-to-day Scala programming. Let’s take a closer look:
Scala 3 support improvements
Our main focus in this release has been Scala 3 support:
- We’ve added highlighting, navigation, and autocompletion for
- Autocompletion is now provided for the
exportkeywords, soft keywords, and the quiet syntax.
- The TASTy reader can now parse
package objects, as well as variance and bounds in higher-kinded types.
- The highlighting of lexer and parser errors is now significantly faster.
- There are more inspections that are compatible with Scala 3.
- We’ve improved the resolution of
givenimports and implemented support for
finaltop-level members and abstract
Because Scala 3 support is actively being developed, we recommend using the nightly plugin builds to benefit from the new improvements. To do that, select Nightly builds in Settings | Languages | Scala | Updates | Channel (you can revert to an earlier build in the same place at any time).
While everyone in the IntelliJ Scala team has been focusing on Scala 3, we have attracted interns to implement other features, such as the Data Flow Analysis in this release or the Package Search Integration in the previous one. We’d like to thank them for all the work they’ve done to improve the plugin!
Open cross-compiled projects as Scala 2
Many projects that should be compiled for both Scala 2 and Scala 3 are modeled as Scala 3 projects cross-compiled for Scala 2, even though technically they are Scala 2 projects. (Please don’t confuse cross-compiled projects with mixed Scala 3 / Scala 2 projects, where each module is either Scala 2 or Scala 3, but not both.) Opening such projects as Scala 2 allows the IDE to use the technically correct Scala version and is more reliable:
If you look at the scala3-cross.g8 template, you can see that
crossScalaVersions includes both
scalaVersion is set to
scala3Version Why does the default Scala version matter? If you only need to build the project, the default Scala version isn’t important. However, if you open the project in an IDE, there are a couple key differences.
Scala 3 libraries store public APIs in
.tasty files rather than in
.class files. Even if there are no Scala 3 features in those APIs, the IDE has to use Scala 3 algorithms. There are many more IDE features that are necessary for Scala 3 but that are not optimal for Scala 2. It’s wise to use battle-tested and well-optimized implementations when working with Scala 2 code.
If the IDE thinks that a project contains Scala 3, it may actually use Scala 3 features on editing, code generation, and refactoring, even though these features must not be used when compiling the code for Scala 2. Thus, opening a cross-compiled project as Scala 2 is technically more correct. You can configure which version of Scala is used in cross-compiled projects at any time in Settings | Build Tools | sbt.
Data flow analysis for Scala
The Scala plugin now supports data flow analysis, which can help you detect programming errors more easily:
You can read our recent blog post for more details.
Autocomplete for Scala compiler options
There are tons of different options in the Scala compiler, though very few programmers learn them all by heart. Furthermore, those options vary depending on the Scala version in use.
You can now autocomplete the applicable options and see quick documentation for each of them:
Inlay hints for ranges
Have you ever wondered whether
1 to 3 is an inclusive or exclusive range? What about
1 until 3? Or
Range(1, 3)? No need to worry – now the answer is clear:
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…