Scala Plugin
Scala Plugin for IntelliJ IDEA and Android Studio
IntelliJ Scala Plugin 2024.3 Is Out!
Scala 3 support
Transparent inline methods (experimental)
Transparent inline methods in Scala 3 allow the compiler to reinterpret the method being inlined in the context of information known already at the compile time. Our support of this feature is still experimental and requires more work, but what we offer in this release already covers the most popular use cases. For example, when a transparent inline method serves as an entry point to a library that uses macro, you will now get much more information about the inferred types than before:
Figuring out the result type of a transparent inline method call can often be quite complicated. To do this, we rely on the type information returned by the compiler, meaning that this feature is available only with Compiler-Based Highlighting. To enable the support for transparent inline methods in IntelliJ IDEA, go to Settings | Languages & Frameworks | Scala | Editor, ensure that the error highlighting mode is set to Compiler (as is the default for Scala 3), and check “Use types reported by the Scala compiler (experimental)”.
We are still working on many improvements to this feature. We encourage you to try it out and let us know your thoughts. Your feedback is very valuable to us.
Named tuples
IntelliJ IDEA 2024.3 fully supports named tuples, a new experimental feature in Scala 3.5 that will become a standard feature in Scala 3.6. As the title suggests, named tuples allow you to name the components of a tuple so that they can be accessed with readable names. On top of that, the compiler can infer the types of fields based on the assigned values.
As we move towards Scala 3.6, named tuples will become an integral part of the Scala language, and we are proud to say that the IntelliJ Scala Plugin has supported them from day one.
Opaque type aliases
Additionally, IntelliJ IDEA is now better at recognizing opaque type aliases. We already recognized the opaque
keyword, but in practice, IntelliJ IDEA has handled opaque type aliases just like standard (i.e., transparent) type aliases. Since the current release, they are treated as abstract types, meaning their underlying definitions are hidden from the outside code.
Scala CLI
IntelliJ IDEA 2024.3 introduces improved support for Scala CLI projects. When you open a folder containing a project.scala file, the plugin automatically recognizes it as a Scala CLI project. Additionally, the new release provides a convenient way to create new Scala CLI projects through the New Project wizard. And, when you do this, you can add new Scala files to the project, just as you can for sbt-based projects. This makes it easier than ever to start developing Scala CLI applications in IntelliJ IDEA.
More improvements to Compiler-Based Highlighting
On top of the support for transparent inline methods, the new release comes with faster and more reliable Compiler-Based Highlighting. We reduced the number of cases when multiple compilations were necessary, e.g., in situations where refactorings that affect multiple files result in many compilation requests. IntelliJ IDEA analyzes and batches these requests in the new release and then issues a single request with a broader compilation scope. This reduces CPU resource utilization and optimizes the compiler’s highlighting experience. We’ve also fixed some edge cases where duplicated parser errors are shown, both from the IDEA Scala parser and the compiler.
New project model for sbt projects (beta)
We’re introducing a new mode that better represents the structure of sbt projects in IntelliJ IDEA by organizing main and test sources into separate modules. The improved layout resolves several issues with compilation and highlighting and allows the use of distinct compiler options for main and test sources.
This feature is currently in “beta”. We strongly encourage you to try it out and share your feedback! Enable it via Settings | Build, Execution, Deployment | Build Tools | sbt and select “Create separate modules for production and test sources”.
Stay tuned for a blog post we plan to publish soon, describing this new feature in detail!
The debugger
In the debugger, we now support the new encoding of lazy vals introduced in Scala 3.3, and we reintroduced the “Initialize” button for lazy vals.
AI Assistant
Completing just one line of code quite often is not enough, so since the new release, we have made multiline cloud-based code completion available for Scala. To enable it, go to Settings | Editor | General | Inline Completion, scroll down, and check “Enable cloud completion suggestions” if it’s not checked already. On the list below, check Scala.
As you can see in the following short video, if the AI Assistant decides it can reliably guess the following lines of code you want to write, it will propose the whole chunk. To do it, though, the AI Assistant requires a connection to the server – the local model can still only propose one-line completions – so be sure you can use it.
The AI Assistant comes with many other features that can help you in your work. You can read about them here.
Other improvements
We improved the IDE performance and fixed certain bugs that led to the UI freezing. This happened sometimes during refactorings and actions, e.g., when you extended a Java interface in Scala and requested IntelliJ IDEA implement the new class members. In some other cases, when the action actually needs some time, a progress bar will be shown.
Also, if you open Run | Edit Configurations…, you will notice that the “Environment variables” field now accepts .env files. All Scala-related run configurations (Scalatest, MUnit, Specs2, uTest, Play Framework, SBT, and Scala REPL) can now read environment variables directly from an .env file – a popular format for storing environment-specific configuration variables as key-value pairs. This feature was implemented with help from the Scala community members.
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