-
Notifications
You must be signed in to change notification settings - Fork 32
Template Editor
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.
- Scala Editing
- As-you-type Error Reporting
- Auto Indentation
- Completion Proposals
- Hyperlinking
- Syntax Highlighting
- Text Hover
- HTML Editing (as of Play2 plug-in 0.4.0)
- Anchor-tag Hyperlinking
- Code Folding
- Content Outlines and Quick Outlines
- Completion Proposals
- Javascript and CSS Syntax Highlighting
- Matching Tag Navigation and Highlighting
- Text Hovering
A more detailed overview of the above features follow below.
It shows compilation errors, in two levels.
- Compiling from template file into scala file.
- Compiling result scala file.
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.
By using CTRL+SPACE
(COMMAND+SPACE
on Mac OSX) you can get the usual code completion popup inside Scala fragments.
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).
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
Also it has preference for Play2 Template custom keywords:
Whenever you go over a Scala identifier, it will show you its type.
As of the Play2 0.4.0 plugin, the template editor sports a new array of HTML source-editting features.
Hyperlink jump to files or websites of an anchor-tags' href path.
Expand or contract blocks of code.
Quickly find, view, and jump between different regions of code. Activate the Quick Outline by press CTRL+O
(CMD+O
on Mac OS X).
Just like in Scala code, press CTRL+SPACE
(COMMAND+SPACE
on Mac OSX) to get code completion proposals of both HTML tags and attributes.
Within script
and style
tags, Javascript and CSS code will be syntax highlighted.
Quickly identify start and end tags, and jump between them.
Hover your mouse over HTML elements to get a popup containing the elements description.