Repeating section in live template Follow
Is it possible or could it be implemented to have a repeating section in a live template, similar to emmet but more intelligent in that it would keep adding the enclosed items until a tab or other shortcut is entered.
For example, something along the lines of this if you wanted an array of objects:
$array = (
$REPEAT$'$ARR$' => '$VAL$'%IF NOT LAST%,%ENDIF%$REPEAT$
);
Which when used would produce:
$array = (
'Key1' => 'Val1', <- Repeater key entered
'Key1' => 'Val1', <- Repeater key entered
'Key1' => 'Val1', <- Repeater key entered
'Key1' => 'Val1', <- Repeater key entered
'Key1' => 'Val1' <- Break key entered here and thus final comma is negated...
);
I can see a huge value in having this in the templating system - how about anyone else. Or if it exists please can someone explain how to use it?
Regards,
M
Please sign in to leave a comment.
Not currently possible. You can try implementing the corresponding template function yourself - see http://stackoverflow.com/questions/12156205/how-can-i-add-custom-expression-functions-for-live-templates-in-intellij
Or, feel free to file a request for this feature to youtrack, https://youtrack.jetbrains.com/issues/IDEA