Scala IDE - Play 2 Eclipse Plug-in not highlighting syntax for Scala HTML Templates
Asked Answered
A

2

10

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

enter image description here

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

enter image description here

Analyze answered 5/3, 2013 at 3:37 Comment(0)
A
10

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.

Aphasia answered 9/3, 2013 at 6:1 Comment(3)
skyluc, Configure > Add Scala Nature worked! Thank you so much! How did you get the grey highlighting here on Stack Overflow to show in your answer?Analyze
Check the editing help. Otherwise, you can open existing messages in edit mode, to see how they were written.Aphasia
I use Play 2.1.1. Same problem. Yet no "eclipse plugin" as it's not recommended on 2.1.1 's documentation page for eclipse set up. Seems like the options mentioned above in both mentioned nodes inside "preferences" are not available. What should I do to get html template highlighting? Play newbie.Mayberry
S
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.

Sturges answered 7/3, 2013 at 8:36 Comment(2)
Note: you must have the project with Scala nature, otherwise you'll get an ugly error.Identic
Maxmc, Thanks for the response but after following your instructions, this is the new error I got (right after selecting Template Editor)... Has anyone got this (Scala IDE Play plug-in's Template Editor displaying syntax highlighting for *.scala.html files) working in Eclipse Juno? !enter image description hereAnalyze

© 2022 - 2024 — McMap. All rights reserved.