-
Notifications
You must be signed in to change notification settings - Fork 2
Using return values
You can return various types of values from your script, and the result will be intelligently converted for substitution / completion.
Often, simply calculating some text to be inserted is all a script needs to do. Therefore, "normal" objects that have no special handling, such as Strings and Integers will be toStringed and inserted in the place of the template variable.
Readers and InputStreams will be fully read using the default charset to insert their text.
Returning a collection (or similar type, see below) triggers a completion popup offering all its values.
Each value is itself converted according as described on this page.
Nested collections are flattened.
The following collection-ish types are supported:
-
Maps (using their values only)
['a', 4] // Simple example => a, 4
[a: 'b', c: 'd'] // Map values => b, d
['a', new StringReader('b')] // Recursive conversion => a, b
['a', ['b', 'c']] // Flattening => a, b, c
['a', [abc: ['b', 'c'].stream(), xyz: new StringReader("d")]] // Recursive flattening and conversion => a, b, c, dTODO
TODO