Overview
This plugin extends the Eclipse IDE by providing handy features
to edit and
compile Closure
Templates files.
Syntax coloring
Syntax is automatically colored in the Closure Templates
editor as you type.
Outline view
The outline view provides an overview of your file, and an
easy access to its templates.
Errors and warnings
Potential errors in your template file are detected in
background and signaled by problem markers.
Variable and template name linking
Variable and template name uses are automatically linked to
their definition, allowing navigation and detection of
undefined names.
Launch the Closure Templates compiler
Create launch configurations for template files, and run
them directly from their contextual menu.
If you are also using the
the Closure
Compiler,
the Closure
Library and/or
the Closure
Linter, you may have a look to
the Eclipse plugin
developed for them.
Installation
Requirements
The plugin should run on all platforms where Eclipse and
Closure Templates are supported.
Step 1: Install Base Software
In order to use the plugin, you need:
- Eclipse Kepler (version 4.3 or later). You can download
it from the
Eclipse website.
- The Closure Templates compiler (if you want to compile your
template files). You can download it
there.
Step 2: Install the plugin
- Open again the update manager (menu Help, then Install
new software...).
- In the field Work with:, enter the URL of the update
site:
http://www.normalesup.org/~simonet/soft/ow/update/
- Select the Closure Templates plugin.
- Click on Next and validate the following messages to finalize
the installation.
- During the installation, Eclipe will show a security
warning. You need to acknowledge it.
- At the end of the installation, Eclipse proposes you to
restart Eclipse for the installation to take effect. You
should accept by clicking on Restart Now.
Note: When installing the plugin, the Eclipse
installation tool will automatically install required plugins
from Eclipse repository (including Xtext).
How to use it?
Once you have installed the plugin, you just need to create a
file with the file extension .soy
in any project.
This file will automatically be opened with the customized
editor for Closure Templates. You may register additional file
extensions for template files in the Eclipse Preferences
(menu Window, then Preferences...),
section General > Content Types.
Configuring errors and warnings. You can enable/disable
some warnings on a per-project basis. For this purpose, open
the properties for the project, and open the tab "LESS
validation".
Launching the compiler. In order to launch the Closure
Templates compiler from Eclipse, you need to create a launch
configuration. For this:
- In the menu Run, select Run
Configurations...
- Select Closure Templates in the list on the
left hand side of the dialog, then click on the icon to create
a new launch configuration at the top of this list,
- Configure the options to run the Closure Templates compiler
(in particular, the JAR containing the compiler shall be in
the Java Class Path) and check the option Use this launch
configuration as default.
Once this is done, you may compile any template file by
selecting it in the project explorer, clicking on the right
button to open the contextual menu and selecting Run
as, Closure Templates Compiler. This will use
the default launch configuration you just created. You can also
create specific launch configurations for each of your
stylesheet.
Custom functions and print decorators.The Closure
Template compiler allows to define custom functions and print
directive
in plugins.
If you are using such plugins, you need to declare the custom
functions or print directive, so that they are recognized in
Eclipse. See the following example:
{namespace example}
// This declares a custom JavaScript function having 1 required
// argument, and 2 optional ones.
// @function myFunction 1 2
// This declares a custom print directive having 1 required
// argument, and 2 optional ones.
// @printDirective myPrintDirective 1 2
/** */
{template .test}
{print myFunction(1)|myPrintDirective:1,2}
{print myFunction(1, 'b')}
{print myFunction(1, 'b', 1)}
{/template}
If you do not want to include these declarations in your
working files, you may create a specific .soy
file
in your project for this purpose. These declarations are
exported in the same scope as templates.
License
The plugin is distributed under the
Eclipse
Plublic License Version 1.0.
History
- Version 1.0.13 (2014-11-01):
- Issue
#240:
Compatibility with Xtext 2.7.
- Version 1.0.12 (2014-06-01):
- Issue
#217:
Fix auto-indent.
- Version 1.0.11 (2014-05-25):
- Issue
#197:
Support binary operator
?:
and
function isNonnull
(as well as other new
functions).
- Issue
#205:
Support
variant
in deltemplate
and delcall
.
- Version 1.0.10 (2014-01-26):
- Issue
#182:
support null-safe accessors.
- Issue
#153:
Fix bug with unterminated literal.
- Version 1.0.9 (2013-03-10):
- Issue
#111:
Make some warnings and errors configurable through project
properties.
- Version 1.0.8 (2012-10-14):
- Issue
#90:
Change of syntax coloring preferences does no longer
require restarting Eclipse.
- Issue
#94:
{template} and other similar commands must appear at the
beginning of a line.
- Version 1.0.7 (2012-08-11):
- Compatibility with Eclipse 4.
- Version 1.0.6 (2012-06-16):
- Fix version numbers in plug-in dependencies.
- Version 1.0.5 (2012-05-19):
- Issue
#43:
Support cross-references between templates defined in
different files sharing the same namespace.
- Version 1.0.4 (2012-05-04):
- Issue
#28:
better parsing of
css
commands.
- Version 1.0.3 (2012-04-22):
- Issue
#27:
handle full expression as range for
foreach
.
- Version 1.0.2 (2012-04-07):
- Fix bug in the release of version 1.0.1.
- Version 1.0.1 (2012-04-04):
- Issue
#14:
fixing bug in parsing of some HTML attributes.
- Issue #18:
fixing bug in parsing of //.
- Version 1.0.0 (2012-03-08):
- New lexer, much better performance.
- Issue
#1:
better detection of unused parameters
with
{call ... data="all"}
.
- Issue #6:
fixing some parsing errors.
- Issue #9:
handling of the (undocumented)
let
command.
- Issue #10:
handling of the
autoescape
attribute for
the namespace
command.
- Version 0.9.0: Beta version.
Known issues
The following features are not supported in the editor: