Skip to content

bjansen/pebble-intellij

Repository files navigation

IntelliJ plugin for Pebble Gitter GitHub Actions GitHub release Coverage

This plugin provides support for the Pebble templating engine in IntelliJ IDEA 2017.3 and later.

IntelliJ plugin for Pebble

Features

  • parser/lexer1 and syntax highlighter (supports custom delimiters)
  • live templates for built-in tags
  • braces matching, code folding and commenting
  • quote handler
  • navigation (methods and fields, included files)
  • code completion
  • highlight unknown references
  • support for variables and functions introduced by pebble-spring
  • more to come

1: Custom operators are currently not supported.

Installation

This plugin is available in JetBrains' plugin repository, from your IDE go to Preferences > Plugins and enter pebble in the search bar.

Mixing Pebble and other languages

To make the editor recognize two languages in the same file, for example HTML and Pebble, go to Preferences > Languages & Frameworks > Template Data Languages and select the HTML data language on the directory that contains your Pebble templates:

Template data languages settings

This will enable features like syntax highlighting, code completion, navigation, Emmet expansions etc.

Using code completion

In order to use code completion, you will have to let the plugin know what the type of foo is. This can be done using @pebvariable hints, much like in the JSP, FreeMarker and Velocity plugins:

Code completion

@pebvariable hints can be easily added to templates via the var live template. They must follow this syntax:

{# @pebvariable name="<name>" type="<type>" #}

For code completion to work properly in the type attribute, your .peb files need to be placed under a content root (e.g. src/main/resources). Otherwise, classes defined in your own source files won't be suggested.

Nightly builds

Snapshot builds are available as part of the Actions CI: