Citrus Templating (Functions and Validation Matchers)
Citrus functions and validation matchers highlighting
Citrus provides functions to generate custom content in your messages during test execution. It also provides various validation matchers to validate or ignore parts of messages during validation.
In order to make them stand out more inside String literals and similar elements, simple highlighting is implemented.
NOTE:
- This is not an actual language support, it cannot be injected into eligible elements. That may come in a later version.
- Customizable color settings may come in a later version (maybe along with the actual language support).
Coloring
The coloring of Citrus function elements is applied according to the following attributes in Settings
> Editor
> Color Scheme
> Language Defaults
:
citrus:
part: Keyword- Citrus or non-Citrus function name and parenthesis: Identifiers > Function call
- integer and float numbers: Number
false
,true
,FALSE
,TRUE
values: Identifiers > Constant- string literals enclosed by
'
symbols: String > String text - validation matcher @ symbols and matcher names: Classes > Static method
- other argument types: Identifiers > Local variable
Nested Citrus functions and matchers are also highlighted properly.
The coloring may be different in different IDEs depending on the color scheme settings.
Settings
The syntax highlighting can be enabled/disabled per language in the plugin settings. Currently supported languages/file types:
- Java: in String literals and text blocks
- XML: in tag texts and tag attribute values
- JSON: in string literals
- YAML:
- In plain (unquoted) text, single- and double-quoted strings.
- It is disabled by default.
- It requires the YAML plugin to be enabled.
- Groovy:
- In single-, double-, tripe-single- and triple-double-quoted string. Dollar-slashy strings are not supported.
- It is disabled by default.
- It requires the Groovy bundled plugin to be enabled.
Code completion of citrus: functions
When invoking code completion in String literals, at a caret position that is directly preceded by the citrus:
prefix, the list of available functions are displayed with
- the name of the function
- the parameter list of the function (parameters enclosed by [ and ] are optional)
The corresponding Citrus function implementation classes are also attached to each list item, so that they can be navigated to (e.g. via Ctrl+B), and quick documentation of them can be accessed (e.g. via Ctrl+Q).
Currently, there is no restriction on the location of the String literals to invoke the completion. The completion is invoked anywhere regardless of containing class or method call being related to Citrus.
However, the completion works only in String literals/text blocks in which there is no language injected, and in the following elements:
- Java: in String literals and text blocks
- XML: in tag texts and tag attribute values
- JSON: in string literals
- YAML: in plain (unquoted) text, single- and double-quoted strings.
- Groovy: in single-, double-, tripe-single- and triple-double-quoted string. Dollar-slashy strings are not supported.
Code completion of validation matchers
When invoking code completion in any Java String literal, at a caret position that is directly inside two @
symbols, the list of available matchers are displayed with
- the name of the matcher
- the parameter list of the matcher (parameters enclosed by [ and ] are optional)
The corresponding Citrus matcher implementation classes are also attached to each list item, so that they can be navigated to (e.g. via Ctrl+B), and quick documentation of them can be accessed (e.g. via Ctrl+Q).
Currently, there is no restriction on the location of the String literals to invoke the completion. The completion is invoked anywhere regardless of containing class or method call being related to Citrus.
However, the completion works only in String literals/text blocks in which there is no language injected, and in the following elements:
- Java: in String literals and text blocks
- XML: in tag texts and tag attribute values
- JSON: in string literals
- YAML: in plain (unquoted) text, single- and double-quoted strings.
- Groovy: in single-, double-, tripe-single- and triple-double-quoted string. Dollar-slashy strings are not supported.