Consider the following JSON schema snippet:
{
"label": "New spell",
"description": "Creates a new spell",
"body": {
"name": "$1",
"source": "$2",
"page": "${3}",
"tradition": "$4",
"type": "${5|U,A|}",
"level": "${6}",
"description": ["$7"]
}
}
Both page
and level
need to be an integer (can default to 0
), but also be a tabstop. I have tried a few things, but the only value that acts as a tabstop is enclosed in quotes, so it ends up being a string.
Is there a way to add a tabstop where the default value is a number?
2
Answers
As it says in the documentation:
The value string needs to be specified as
"^${3:0}"
.So, the snippet fixed:
This would work to set a tabstop 3 and 6 with defaults of 0. Note that the quotes must be escaped.
Also the general form of a snippet is as follows:
There is no
label
property and there should be aprefix
property. Andbody
, if multiple statements is an array.