{"id":4857,"date":"2019-11-28T14:29:40","date_gmt":"2019-11-28T13:29:40","guid":{"rendered":"https:\/\/blog.jetbrains.com\/scala\/?p=2294"},"modified":"2023-06-13T12:07:54","modified_gmt":"2023-06-13T11:07:54","slug":"intellij-scala-plugin-2019-3-method-chain-hints-scala-repl-scala-worksheet-and-scalatest-improvements","status":"publish","type":"scala","link":"https:\/\/blog.jetbrains.com\/ko\/scala\/2019\/11\/28\/intellij-scala-plugin-2019-3-method-chain-hints-scala-repl-scala-worksheet-and-scalatest-improvements","title":{"rendered":"IntelliJ Scala Plugin 2019.3: Method Chain Hints, Scala REPL, Scala Worksheet, and ScalaTest improvements"},"content":{"rendered":"<p>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&#8217;s take a closer look.<\/p>\n<p>1. <a href=\"#method-chain-hints\">Method chain hints<\/a><br \/>\n2. <a href=\"#inlay-hint-settings\">Inlay hint settings<\/a><br \/>\n3. <a href=\"#searchable-settings\">Searchable settings<\/a><br \/>\n4. <a href=\"#scala-repl-improvements\">Scala REPL improvements<\/a><br \/>\n5. <a href=\"#scala-worksheet-improvements\">Scala Worksheet improvements<\/a><br \/>\n6. <a href=\"#scalatest-gutter-icons\">ScalaTest gutter icons<\/a><br \/>\n7. <a href=\"#up-to-date-java-to-scala-converter\">Up-to-date Java-to-Scala converter<\/a><\/p>\n<h2 id=\"method-chain-hints\">Method chain hints<\/h2>\n<p>To tell the truth, the &#8220;new&#8221; feature is not <em>entirely<\/em> new because starting with version 2018.2, IntelliJ IDEA has been able to show <strong>type hints for long method chains<\/strong>:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2019\/11\/scala-java-method-chain-hints.png\" alt=\"java-method-chain-hints\" width=\"750\" height=\"300\" class=\"alignnone size-full wp-image-2351\" \/><\/p>\n<p>This functionality, however, has been limited to Java. What&#8217;s more, the Java&#8217;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 <strong>in a separate column<\/strong>:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2019\/11\/scala-scala-method-chain-hints-2.png\" alt=\"scala-method-chain-hints-2\" width=\"750\" height=\"300\" class=\"alignnone size-full wp-image-2381\" \/><\/p>\n<p>This mode is indeed new, and only the Scala plugin can show the aligned hints so far. In functional programming, there&#8217;s the idea that &#8220;names are not important, only types are.&#8221; Withdrawing judgment, you can definitely learn a lot simply by looking at the <em>type flow<\/em>. In some sense, <strong>this feature reveals the &#8220;type level&#8221; of your code<\/strong>. (Interestingly, you cannot easily replicate that in the code as such. While you can add type annotations explicitly, there&#8217;s no easy way to add type ascription to each line in a long chain of method calls.)<\/p>\n<p>We also offer the <strong>classic presentation<\/strong>. Even that mode is less noisy than Java&#8217;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.<\/p>\n<h2 id=\"inlay-hint-settings\">Inlay hint settings<\/h2>\n<p>The Scala plugin now takes advantage of IntelliJ IDEA&#8217;s dedicated <strong>settings for inlay hints<\/strong> (in <em>Settings | Editor | Inlay hints<\/em>):<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2019\/11\/scala-hint-settings.png\" alt=\"hint-settings\" width=\"750\" height=\"300\" class=\"alignnone size-full wp-image-2357\" \/><\/p>\n<p>We&#8217;ve rearranged and simplified the settings, and added <strong>examples<\/strong> that demonstrate the hints right away. The basic options are also available in the <strong>context menu<\/strong>:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2019\/11\/scala-context-menu.png\" alt=\"context-menu\" width=\"750\" height=\"300\" class=\"alignnone size-full wp-image-2359\" \/><\/p>\n<p>You can open the extended settings by using the <em>Configure&#8230;<\/em> command.<\/p>\n<h2 id=\"searchable-settings\">Searchable settings<\/h2>\n<p>As you probably know, you can simply <strong>type a query<\/strong> to start searching IntelliJ IDEA&#8217;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&#8230; until now:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2019\/11\/scala-settings-search.png\" alt=\"settings-search\" width=\"750\" height=\"300\" class=\"alignnone size-full wp-image-2362\" \/><\/p>\n<p>OK, hardly revolutionary, but it&#8217;s a nice thing to have.<\/p>\n<h2 id=\"scala-repl-improvements\">Scala REPL improvements<\/h2>\n<p>Amazing but true: the Scala plugin has a <strong>built-in Scala REPL<\/strong> that doesn&#8217;t require tinkering with terminals, classpath, and installing Scala binaries in your operating system. You can start the REPL by invoking <em>Tools | Scala REPL<\/em> (or by pressing <em>Ctrl + Shift + D<\/em>):<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2019\/11\/scala-scala-repl.png\" alt=\"scala-repl\" width=\"750\" height=\"300\" class=\"alignnone size-full wp-image-2364\" \/><\/p>\n<p>This feature is not widely known, not least because of the previously subpar UX. In this release, we&#8217;ve made this feature a lot more usable:<\/p>\n<ul>\n<li>It is now called &#8220;Scala REPL&#8221;, not &#8220;Scala Console&#8221;.<\/li>\n<li>You can use <em>Enter<\/em> instead of <em>Ctrl (Cmd) + Enter<\/em>.<\/li>\n<li>The input is placed right after the `scala>` prompt, not a few lines below.<\/li>\n<\/ul>\n<p>So, the build-in Scala REPL now works <strong>very much like the standard Scala REPL<\/strong>. If you did not use the built-in version before, you are welcome to try this one.<\/p>\n<h2 id=\"scala-worksheet-improvements\">Scala Worksheet improvement<\/h2>\n<p>Scala Worksheet is another feature that is revamped in this release as we&#8217;ve added more <strong>reliable error handling<\/strong>. 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.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2019\/11\/scala-scala-worksheet.png\" alt=\"scala-worksheet\" width=\"750\" height=\"300\" class=\"alignnone size-full wp-image-2366\" \/><\/p>\n<h2 id=\"scalatest-gutter-icons\">ScalaTest gutter icons<\/h2>\n<p>You can now run <strong>individual<\/strong> <code>ScalaTest<\/code>s:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2019\/11\/scala-scala-test-gutter-icons.png\" alt=\"scala-test-gutter-icons\" width=\"750\" height=\"300\" class=\"alignnone size-full wp-image-2370\" \/><\/p>\n<h2 id=\"up-to-date-java-to-scala-converter\">Up-to-date Java-to-Scala converter<\/h2>\n<p>The Java to Scala converter is now <strong>up-to-date with Java<\/strong>: it can handle counting loops and switch expressions, and can remove redundant `break` statements automatically:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2019\/11\/scala-java-to-scala-converter-2.png\" alt=\"java-to-scala-converter-2\" width=\"750\" height=\"300\" class=\"alignnone size-full wp-image-2377\" \/><\/p>\n<h2>And much more!<\/h2>\n<p>There are <strong>many more improvements<\/strong>, 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 &#8220;Universal AST&#8221;, so that you can benefit from universal Android and Spring inspections in the platform. The support of Scala 2.13 has also been improved.<\/p>\n<p>What really matters is that all this is included <em>in the release<\/em>. We use the Scala plugin ourselves to develop the Scala plugin, and we feel that spending some time on polishing was definitely worth it \u2013 the plugin is now more reliable and pleasant to work with, which is definitely important if you like to <strong>develop with pleasure<\/strong> :)<\/p>\n<p>Your feedback is very welcome, as always.<\/p>\n<p>Sincerely,<\/p>\n<p>The <a href=\"https:\/\/twitter.com\/IntelliJScala\" target=\"_blank\" rel=\"noopener\">IntelliJ Scala Plugin Team<\/a><\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","categories":[808,89,907,8058,6945],"tags":[83,6836,225],"cross-post-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/scala\/4857"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/scala"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/types\/scala"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/comments?post=4857"}],"version-history":[{"count":1,"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/scala\/4857\/revisions"}],"predecessor-version":[{"id":273102,"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/scala\/4857\/revisions\/273102"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/media?parent=4857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/categories?post=4857"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/tags?post=4857"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ko\/wp-json\/wp\/v2\/cross-post-tag?post=4857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}