Skip to content
dragos edited this page Apr 5, 2013 · 9 revisions

A Play2 Template is a simple text file that contains small blocks of Scala code. Templates can generate any text-based format, such as HTML, XML or CSV.

Below follows the set of features that are currently supported for Template files.

Syntax Highlighting

Syntax Highlighting for:

  • HTML Tags: It provides different coloring for attributes, tag name, values, and string literals.
  • Scala Code: It provides different coloring for different tokens of scala.
  • Comments

Template Syntax Highlighting Preview

Also it has preference for Play2 Template custom keywords:

Template Preference Page for Syntax Coloring Preview

Errors-as-you-type Reporting

It shows compilation errors, in two levels.

  • Compiling from template file into scala file.

Template Error Template Preview

  • Compiling result scala file.

Template Error Scala Preview

Text Hover

Whenever you go over a Scala identifier, it will show you its type.

Template Text Hover Preview

Hyperlinking

You can hyperlink to elements of another Scala source file (Hyperlinking for elements of another template file or java file is not supported at the moment).

Template Hyperlinking Preview

Code Completion

By using CTRL+SPACE (COMMAND+SPACE on Mac OSX) you can get the usual code completion popup inside Scala fragments.

Template Code Completion Preview

Auto-indentation

The template editor follows a very simple heuristic to automatically indent after a new-line character. By default, it indents to the previous line, except if there is an open parenthesis/brace on the current line, when it increases the indent by the tab size.

You can control the tab size and the tab-vs-spaces setting in the Editors -> Text Editors Eclipse configuration.

Tab and spaces setup

Clone this wiki locally