robguinness
robguinness

Reputation: 16656

Syntax highlighting for scala.html and routes files in IntelliJ / Play framework

I am new to both IntelliJ and the Play framework. I noticed that after installing IntelliJ and importing my first Play application, syntax highlighting is not working properly for both *.scala.html files and the routes files. I was able to modify the settings for the *.scala.html files to have them recognized as Scala files, but this isn't actually correct because the scala templating system is not pure Scala.

Here's a screenshot, in case it helps:

enter image description here

In the official Play video tutorials there seems to be a special syntax highlighting setting for these template files, but I don't know how to add this to IntelliJ. Here's a screenshot from this tutorial and how I would like the syntax highlighting to look:

enter image description here

Also, I couldn't find any solution for the routes file. Any help would be most appreciated!"

P.S. I enabled the Vim emulator during installation of IntelliJ. I don't know if this had any effect on the syntax highlighting defaults...

Upvotes: 5

Views: 3571

Answers (2)

Vinay
Vinay

Reputation: 1270

Playframework full support in only available in IntelliJ ultimate edition a commercial one.

Community edition (free version) that you probably are using doesn't have any support for playframework it only supports Scala (language).

Routes and *.scala.html files are part of the framework not the language.

You may like to purchase IntelliJ ultimate edition or would like to go for Scala IDE (based on eclipse) which is an open source IDE for java and scala, it seems to have full support for play 2.x.

Upvotes: 6

mohoromitch
mohoromitch

Reputation: 76

For *scala.html syntax highlighting

Preferences > Plugins > Install Jetbrains plugin...

Then install the Scala plugin

Restart IntelliJ and syntax highlighting should work.

For routing file highlighting

Preferences > Editor > File Types

Under the registered patterns for HTML Routing Support For Play 2 Framework if *.routes isn't already there, add it. Or add however you plan on naming your routes files.

Upvotes: 1

Related Questions