Reader

IntelliJ Scala Plugin 2025.1 Is Out!

| The JetBrains Blog | Default

Support for new features in Scala 3

Context Bounds and Givens

Scala 3.6 introduced a new syntax for context bounds and givens. You can read more about it in SIP-64. In short, before Scala 3.6, it was impossible to name the context bound in the same place where it was defined. The way to do it was to introduce an implicit parameter, which resulted in awkward syntax, e.g. def reduce[A](xs: List[A])(using m: Monoid[A]): A introduced the context bound Monoid[A] as m. In the new syntax, it’s possible to simply write def reduce[A: Monoid as m](xs: List[A]): A and IntelliJ IDEA with the Scala plugin recognizes it and supports it.

In a similar vein, we now support the recent changes in the given syntax.

Three old ways to declare and name a context bound vs the new syntax
Three old ways to declare and name a context bound vs the new syntax
Multiple context bounds
Multiple context bounds
Solving an old issue of a forward declaration of a context bound
Solving an old issue of a forward declaration of a context bound

Named Tuples

Scala 3.7 brings the stabilization of Named Tuples and IntelliJ IDEA 2025.1 with the Scala Plugin already supporting them. In the new release, apart from simply recognizing the syntax for Named Tuples, we also support them in pattern matching, when you can both match against a given value of one of the tuple’s fields, and extract that value to a new reference. On top of that, Scala 3.7 comes with a new way to extract a field value from a case class or a class with a customized unapply method that returns a named tuple. Until now, we could either use the underscore to mark all the fields we were not interested in when calling the unapply, or we could assign a whole class instance to a reference and then access the field we wanted through that reference.  Now, it’s possible as well to simply name the fields we are interested in and assign their values to new references.

You can read more about Named Tuples in SIP-58.

Refutable patterns in for-comprehensions

Since Scala 3.4, refutable patterns (i.e., patterns that might not match) in for-comprehensions must be preceded by the case keyword, or an error is reported. The new syntax helps recognize those cases.

Other Scala 3 improvements

The resolution of nested implicit definitions is now more precise, which means that now Scala Plugin reports some errors that weren’t caught before, while in other situations we no longer highlight code red where the code compiles just fine. The handling of intersection types used to define the “self” type was improved, and the support for named tuples, that we introduced recently. Besides, the Scala 3 code is now correctly highlighted in code snippets in Markdown files displayed in IntelliJ IDEA.

The debugger

We fixed a bug in Scala 2.13.3 where the debugger didn’t stop on breakpoints inside lazy vals in try/catch blocks, and another, similar, when the debugger sometimes had trouble stopping at breakpoints inside lambdas in a trait.

sbt

We made several improvements to the new separate production/test modules. A new “Generate sbt managed sources” action helps avoid situations when good code is red because it relies on sources generated during the project import. On top of that, the “New Project” wizard now suggests downloading the JDK for a new sbt project, and we don’t show anymore the banner “No Scala SDK in module” when at the same time we offer to simply load the sbt project, which will automatically setup SDK.

Code highlighting and inlay hints

In the 2024.3 release, we introduced support for transparent inline methods in Scala 3. Now, as we continue to work on support for Scala macros, we offer support for Scala 2 macro types. Also, we improved type hints for variable patterns, generators, and literal parameters, as well as type info for underscore parameters and kind projector syntax. The X-Ray mode was enhanced as well: you can now enable parameter name hints for all parameters, not only literals, and see when the apply method is being used, instead of an ordinary constructor.

Other changes

Code completion can now provide partial results during indexing. Besides, when you use Code With Me for Scala projects, we fixed an issue when you would see that the auto-import quick-fix is offered only after code editing on the host.

As always, your feedback is very welcome. Please report any issues you find to YouTrack. If you have any questions, feel free to ask us on Discord.

Happy developing!

The IntelliJ Scala Plugin team