GoLand 2024.1 Help

Template languages: Velocity

GoLand lets you develop templates in Velocity (VTL) .

Coding assistance and syntax highlighting rely on the Apache Velocity plugin that you need to install and enable. For more information, refer to Install plugin from Marketplace.

Template language directives completion
Template language variables completion

The following file types are supported by default:


.ft, .vm, .vsl

To enable coding assistance for languages in which the static part of the template is written (those are referred to as template data languages), do one of the following:

Associate the template data language with files and folders in your project

  1. In the Settings dialog (Ctrl+Alt+S) , click Languages and Frameworks and then click Template Data Languages.

  2. Click the template data language cell to the right of the project or the corresponding directory or file, and select the language.

  3. Click OK to apply changes.

Individual template files can be assigned a template data language directly in the editor using the Change template data language to context menu command.

Add an extension pattern for the corresponding file types

  1. In the Settings dialog (Ctrl+Alt+S) , click Editor and then click File Types.

  2. Under Recognized File Types, select Velocity Template.

  3. Under File name patterns, click .

  4. In the Add Wildcard dialog, specify the file name extension pattern, select a language, and click OK.

  5. Click OK to apply changes.

Fixing unresolved references

GoLand provides inspections for detecting unresolved references in template languages:

Example template language inspection for unresolved references

Unresolved references can be fixed using intention actions. You can select to add a comment in the same file, or to create a separate file with comments. For more information, refer to Special comments.

Example template language intentions for fixing unresolved references

In the latter case, a file with the default name velocity_implicit.vm is created. This file starts with the following comment:

#* @implicitly included *#

Code completion for defining reference types is available in the comments files.

If you rename the file or move it to a different location within the source root, reference definitions will not be lost.

Special comments

GoLand provides the following special comments for working with template languages:

Velocity comments are delimited using #* and *#.



@implicitly included

Any Velocity file that starts with this comment is included in all files that are in the same module. Use such a dedicated comments file to define IDE-specific comments, so that they do not pollute your template files.


Defines a variable. For example, the following comment declares a variable named foo of type String, visible only in the specified file:

#* @vtlvariable name="foo" type="java.lang.String" file="path/to/file" *#

To properly resolve String in this case, the module should have JDK attached. Primitive and generic types are supported. The file parameter is optional.


Defines the file with template macros relative to the file with this comment. For example, the following comment makes macros from lib.vm accessible to code insight in file.vm:

#* @vtlmacrolibrary path="lib.vm" file="file.vm" *#


Defines the velocity.properties file and the runtime root directory relative to the file with this comment. For example:

#* @velocityproperties path=”path/to/velocity.properties” runtime_root=”path/to/runtime/root/dir” *#
Last modified: 03 April 2024