When creating snippets I would like to know if it is possible to define a default value for a placeholder if no value is assigned.
For example, having this php snippet:
{
"get_list": {
"prefix": "get_list",
"body": "$${1:beanList} = $${2:bean}->get_list('${3:order_by}', \"${4:where}\", ${5:row_offset}, ${6:limit}, ${7:max}, ${8:show_deleted});",
"description": "Get a paginate bean list"
},
}
Where placeholders from tabstops 5 to 8 have the following default values:
$row_offset = 0
$limit= -1
$max= -1
$show_deleted = 0
I tried with choices in the following way, but with no success:
{
"get_list": {
"prefix": "get_list",
"body": "$${1:beanList} = $${2:bean}->get_list('${3:order_by}', \"${4:where}\", ${5:row_offset|0|}, ${6:limit}, ${7:max}, ${8:show_deleted});",
"description": "Get a paginate bean list"
},
}
Please take a look to the row_offset
definition. When the snippet is rendered I get the following
$beanList = $bean->get_list('order_by', "where", row_offset|0|, limit, max, show_deleted);
In this scenario what I would like to happen is in case I omit a placeholder value 0
is assigned.
Thanks for any help.