IntelliJ Scala Plugin 2019.3: Method Chain Hints, Scala REPL, Scala Worksheet, and ScalaTest improvements
Just like IntelliJ IDEA 2019.3, this release of the Scala Plugin is focused primarily on performance boosts and usability enhancements. And yet, we managed to sneak in a cool new feature as well. Let’s take a closer look.
Method chain hints
To tell the truth, the “new” feature is not entirely new because starting with version 2018.2, IntelliJ IDEA has been able to show type hints for long method chains:
This functionality, however, has been limited to Java. What’s more, the Java’s approach is hardly applicable in Scala, where long method chains are much more common and we often pass function literals in curly braces, etc. To prevent method chain hints from interfering with Scala code, we can display the hints in a separate column:
This mode is indeed new, and only the Scala plugin can show the aligned hints so far. In functional programming, there’s the idea that “names are not important, only types are.” Withdrawing judgment, you can definitely learn a lot simply by looking at the type flow. In some sense, this feature reveals the “type level” of your code. (Interestingly, you cannot easily replicate that in the code as such. While you can add type annotations explicitly, there’s no easy way to add type ascription to each line in a long chain of method calls.)
We also offer the classic presentation. Even that mode is less noisy than Java’s counterpart, because the Scala plugin can omit hints when the type is obvious. By the way, you may always tweak the minimum number of unique types in a chain that are required to show the hints.
Inlay hint settings
The Scala plugin now takes advantage of IntelliJ IDEA’s dedicated settings for inlay hints (in Settings | Editor | Inlay hints):
We’ve rearranged and simplified the settings, and added examples that demonstrate the hints right away. The basic options are also available in the context menu:
You can open the extended settings by using the Configure… command.
As you probably know, you can simply type a query to start searching IntelliJ IDEA’s Settings. So far so good, but this capability requires a special assistance from setting providers, and most Scala-related settings have not been searchable… until now:
OK, hardly revolutionary, but it’s a nice thing to have.
Scala REPL improvements
Amazing but true: the Scala plugin has a built-in Scala REPL that doesn’t require tinkering with terminals, classpath, and installing Scala binaries in your operating system. You can start the REPL by invoking Tools | Scala REPL (or by pressing Ctrl + Shift + D):
This feature is not widely known, not least because of the previously subpar UX. In this release, we’ve made this feature a lot more usable:
- It is now called “Scala REPL”, not “Scala Console”.
- You can use Enter instead of Ctrl (Cmd) + Enter.
- The input is placed right after the `scala>` prompt, not a few lines below.
So, the build-in Scala REPL now works very much like the standard Scala REPL. If you did not use the built-in version before, you are welcome to try this one.
Scala Worksheet improvement
Scala Worksheet is another feature that is revamped in this release as we’ve added more reliable error handling. Previously, there could be an error, but no visual feedback. Now, Scala Worksheet can handle multiple types of possible errors, which can now be easily detected and acted upon.
ScalaTest gutter icons
You can now run individual
Up-to-date Java-to-Scala converter
The Java to Scala converter is now up-to-date with Java: it can handle counting loops and switch expressions, and can remove redundant `break` statements automatically:
And much more!
There are many more improvements, but they are both too numerous and too technical to include in the blog post. For instance, the Scala plugin now supports the so-called “Universal AST”, so that you can benefit from universal Android and Spring inspections in the platform. The support of Scala 2.13 has also been improved.
What really matters is that all this is included in the release. We use the Scala plugin ourselves to develop the Scala plugin, and we feel that spending some time on polishing was definitely worth it – the plugin is now more reliable and pleasant to work with, which is definitely important if you like to develop with pleasure :)
Your feedback is very welcome, as always.
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…
Performance tips for IntelliJ Scala Plugin
A full-blown IDE is one of the most complicated applications you can find on an average laptop. This is why we – the Scala plugin team at JetBrains – from time to time receive reports that our product lags in certain situations or works slowly in general. In some of these cases we can help, but in o…