Philip Johnson Philip Johnson - 3 months ago 10
Scala Question

How to eliminate error underlining in IntelliJ 14.0.3 for Play 2.3.7 application?

I am using IntelliJ IDEA 14.0.3 to develop a Play 2.3.7 application using the Scala 1.3.3 plugin.

The attached screenshot shows that IntelliJ underlines the parameter to a render method as invalid when, in fact, the system compiles and runs successfully both in IntelliJ and at the command line (using Activator):

play-intellij-confusion

Another user has reported this problem in IntelliJ when the view template file uses Scala-specific syntax (i.e.

Form[formdata.ContactFormData]
) while the controller uses Java-specific syntax (i.e.
Form<formdata.ContactFormdata>
). That is the case here as well.

The sources to illustrate this problem are available at: https://github.com/philipmjohnson/intellij-play-error-highlight-problem

Is this indeed a bug in IntelliJ or its Scala plugin? Are there any workarounds?

Answer

My team and I have this same issue, using Intellij 14.0.3, Scala 1.3.3 plugin and Play 2.3.8.

To workaround this I open File --> Project Structure, then click on "Modules" on the left side bar. Adding target/scala-2.11/src_managed/main to the sources eliminates these reverse routing underlines. Make sure that the root target directory is not in the excluded folders.

One thing to note however, is that Intellij seems to remove this from the sources from time to time, causing much annoyance...

Intellij 14 Modules