IntelliJ IDEA Scala Plugin 2017.3: Lightbend project starter, Ammonite support, Parallel indexing, and more

First of all, we want to thank all the contributors who helped implement many useful features, bugfixes, and refactorings. You really inspire us to do our very best work. Your input is greatly appreciated!

Now let’s take a look at the new features you’ll find in Scala Plugin 2017.3.

Highlighting of implicit usages

Most likely you are already familiar with this highlighting feature (it uses violet in the Default Theme), which usages of the symbol under the caret across the opened file. Starting with this release, it also highlights places where the target is used implicitly:
Implicit usages highlighting in IntelliJ IDEA

Build, Run, and Test processes do not depend on indexing anymore

IntelliJ IDEA performs indexing to power many of its features such as code highlighting, inspections, etc. In theory, indexing should not be required for processes like building or running tests. Nevertheless, previous versions had a number of dependencies that forced you to wait until the indexing finished. We have completely separated that logic, so you can run your existing run_configurations (application, tests …) in parallel with indexing. It’s very helpful in big projects where indexing takes considerable time.
Parallel execution in IntelliJ IDEA

Automatic suggestion to import SBT library

Now, if you add an import with unresolved packages that IntelliJ IDEA cannot find in your project’s External dependencies, the plugin suggests finding it in a local Ivy cache. If it finds the correct library, it adds the corresponding dependency to build.sbt (you can select the location).
sbt library suggester in IntelliJ IDEA

Ammonite scripts support

The Scala plugin in 2017.3 also provides support for Ammonite scripts. We’ve added:

  • Accurate highlighting and navigation that respects ammonite syntax;
  • Run configuration with a gutter icon for launching scripts;
  • Ammonite annotations;
  • An action for importing $ivy. dependencies. This may be required for proper resolution in the Editor.

As Ammonite is an external tool, there are some prerequisites for its usage:

  • Ammonite must be installed in your OS.
  • IntelliJ IDEA needs to knows where the Ammonite executable is located. You can:
    • add a symlink to already accessible places like usr/bin;
    • modify the $path variable;
    • specify the path to the Ammonite executable in Default Ammonite Run Configuration, using the “Amm executable” field.
  • Your project must have appropriate dependencies on Ammonite libraries. This is required for code processing in the Editor. If you use sbt in your project, you can add an sbt dependency. If your project is just a set of scripts, please get libraries from Maven repository and add them in the Project Structure settings. Usually, “ammonite_2.*.jar” and “ammonite-ops_2.*.jar” are enough, but for some specific operations you may need “…-repl”, “…-runtime”, “…-compiler” or another libraries.
  • Finally, .sc files have to be treated as Ammonite files (by default IntelliJ IDEA treats them as Worksheets). You can define this in File | Settings | Languages & Frameworks | Scala | Worksheet.

Ammonite support in IntelliJ IDEA

A wizard for Lightbend Tech Hub templates

As you may already know, Lightbend Activator was EOL-ed on May 24, 2017. It was substituted with another technology: the “project starter” service. Following these changes, the Scala plugin replaces its New Activator Project Wizard with Lightbend Project Starter Wizard.
Lightbend project starter in IntelliJ IDEA

Additionally, the release brings lots of other improvements, such as better Shapeless and Play2 support in the Editor.

Your feedback is always very welcome. And please do report bugs / ideas you find to our issue tracker. Thanks!

Happy developing!

This entry was posted in New Features, Release report. Bookmark the permalink.

12 Responses to IntelliJ IDEA Scala Plugin 2017.3: Lightbend project starter, Ammonite support, Parallel indexing, and more

  1. Tristan Lohman says:

    Can you elaborate on “better Shapeless” please?

    • mutcianm says:

      Support for Generic, DefaultSymbolicLabelling and shapeless.ops.record.Selector macro for now.
      More macro implementations are coming soon.

  2. Alex says:

    Thank you for Ammonite support!

  3. Nikolay says:

    Ammonite support is cool, thanks!

  4. Mikołak says:

    What are the plans on using the new compile server to provide correct compile error/warning feedback in the IDE? I see there is a tracking issue (SCL-11079, actually predating the current LSP-based implementation), but it hasn’t been updated in a while.

    In the meantime, with the advent of sbt 1.1RC, there is now a prototype plugin for VCS (of all things) that does just that. When are you planning on IDEA to provide this kind of improved compile information flow?

  5. Maciek says:

    Ammonite support is great! It works really nice. But there seems to be no support (syntax highliting) for imported libraries. The code compiles and executes correctly, but the syntax errors are reported. Is there any workaround or planned fix?

    • kubukoz says:

      You probably didn’t mean syntax errors, as these would depend on invalid parsing (whereas this case looks like unknown symbol errors), but there’s a workaround – have a build.sbt file in the same project as the one you’re holding your scripts in, and add each dependency to that sbt file as well as the script. The IDE will know the symbols from the sbt file, the script will know the symbols from imports. Hope it helps 😉

  6. David Pérez says:

    For me, the biggest feature is Ammonite support. Thanks.

  7. Marcin says:

    Ammonite support is really super cool! Thanks!

    Please just add shebang syntax support at the beginning of script:

    #!/usr/bin/env amm

    import ammonite.ops._
    import ammonite.ops.ImplicitWd._

    Currently Intellij highlights it in red, although it should not do it. It is correct syntax and Ammonite works with it. Because of this simple line you can start Ammonite scripts just like bash scripts:

Leave a Reply

Your email address will not be published. Required fields are marked *