Scala IDE - Play 2 Eclipse Plug-in not highlightin

2020-02-22 16:23发布

问题:

I installed the Scala IDE - Play 2 plug-in (from http://download.scala-ide.org/play2/nightly_3.0-M_juno_2.10-M/site/ ) whereas the Route Editor displays proper syntax highlighting, the Template for Scala does not. Also, it also does not allow me to "Enable" the Syntax Highlighting options in Eclipse's Preferences -> Play -> Template - Syntax Coloring.

Therefore, the Scala syntax is not being highlighted inside main.scala.html and index.scala.html

Am also using http://download.scala-ide.org/nightly-scala-ide-juno-210x for Eclipse Juno.

-James

Right mouse click on above image to open in a new browser tab to see image in full resolution.

回答1:

maxmc and valentin_nasta are both right.

We discovered recently that if Eclipse WTP is installed, the bundled html editor is picked over the Play template editor. It is something we will try to improve.

At the moment, you can force Eclipse to use the Play template editor by selecting Open with ... > Template Editor from the context menu, or changing the default for *.html files in Preferences > General > Editors > File Associations.

For the stack trace, it is a known problem. You have to manually mark the project as a Scala project, using Configure > Add Scala Nature from the project context menu.



回答2:

I assume you don't open the file with the correct editor. Right click your *.scala.html file and select Open with..., select Other, then scroll to the bottom and select Template Editor. Then the syntax highlighting should apply.

To make that change permanent, you can press Ctrl-3 and search for File Associations. There you need to select *.html and move the Template editor to the top of the Associated editors.