First of all, we want to thank all the contributors who have helped us to implement so many useful new features, bug-fixes, and refactorings. You really inspire us to do our very best work. Your input is greatly appreciated!
Let’s take a look at the new features you’ll find in Scala Plugin 2018.2.
Improved display of Implicit conversions / arguments usage
Now the editor is capable of providing much more useful information about the “implicit” things happening in your code:
- Scala plugin can show implicit conversions and arguments as inline hints.
- The Editor also shows hints when an implicit argument is used explicitly.
- Inline hints provide navigation to the implicit value or function declaration.
Note, that sometimes implicit parameters are collapsed to
(...). Such folding takes place in case of nested, list of ambiguous arguments, and arguments for conversions.
By the way, ambiguous arguments. We have also re-worked error highlighting. Now, in the same manner, we show places where a function didn’t find an appropriate implicit value, or a set of values is ambiguous.
You’ve probably noticed already, that inline hints work in Editor mode. Enable it by
Ctrl + Alt + Shift + “+” hotkey:
- A second press of the hotkey expands all foldings.
Ctrl + Alt + Shift + “-”will collapse all foldings or disable the mode.
Besides the inline hints we’ve also improved:
- Parameter Info Tooltip (
Ctrl/Cmd + P) by adding the implicit parameter;
- Implicit Arguments Popup (
Ctrl/Cmd + Shift + P) now shows type, structure, and location of arguments.
Autocompletion: exhaustive pattern matching and pattern completion
The Scala plugin now generates an exhaustive match for sealed types with inheritors, Java Enums, and Scala Enumerations. Together with this, the autocompletion list contains an
Autocompletion in Pattern matching suggests a list of typed patterns for applicable classes and interfaces.
Semantic Highlighting support
Now, you can enable semantic highlighting for your project in Preferences/Settings | Editor | Color Scheme | Scala, and assign distinct colors to a function’s parameter, local variable, variable in a pattern-matching case clause, or variable in a sequence comprehension. Then you can scan through a function to track the variable, with no distracting action isolate one of the variables, or switch focus to another variable.
Scalafmt as an alternative to the built-in formatter
The Scalafmt formatter, which used to be its own standalone plugin, is now part of the Scala plugin. It can be configured at Preferences/Settings | Editor | Code Style | Scala. Once the option is set, the reformat action will invoke scalafmt instead of IntelliJ formatter.
Unlike the IntelliJ built-in formatter, scalafmt hasn’t got a lot of Tabs with detailed options, but instead uses a standard way to pass all the settings by a
.conf file. If your project contains a
.scalafmt.conf file, the IDE will suggest setting scalafmt as the active formatter. But you can also have a
.conf file with another name – just specify it in the “Configuration:” setting.
Sometimes scalafmt may be unable to format invalid code. If you want to see warning notifications in the IDE, check this option.
We have also added the “Reformat on compile” option (enable it in Tab “Other”). The option works for both the IntelliJ built-in and scalafmt formatters.
The release brings lots of other usability enhancements and bug-fixes in Gutter icons, ScalaDoc, and Error highlighting. We would like to say a special thanks to the guys from Wix who improved the Move Refactoring by adding the capability to move object members to another object.
Your feedback is always very welcome. Please do report any bugs you find, and share your ideas, in our issue tracker. Thanks!