Suggest "defaultSnippets" for object and array typed properties when completion is done #1077
Description
Is your enhancement related to a problem? Please describe.
When I use completion for a property (say "myProperty"), the automatically generated snippet is only myProperty:
.
Up to me, I'm frustrated because I would like that IDE suggests to me, by default, the list of "defaultSnippets", and if there is only one "defaultSnippet", then the one is automatically played (without showing the list).
Currently, I have to manually tape "tab" to have the list of snippets, which is a pity.
By the way, this is precisely the behavior in VSCODE itself for JSON files associated to a JSON schema.
So this would be great to have the same completion behavior than VSCODE for JSON files.
Describe the solution you would like
- When a property has a single defaultSnippet, play directly the single snippet when completion is done
- When a property has several defaultSnippets, show directly the list of snippets
Example
Given this json schema:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"defaultSnippets": [
{
"label": "(snippet)",
"body": "${1|John,Doe|}"
}
]
},
"myProperty": {
"type": "object",
"defaultSnippets": [
{
"label": "myProperty",
"body": {
"name": "John"
}
}
],
"properties": {
"name": {
"type": "string",
"defaultSnippets": [
{
"label": "Name",
"body": "${1:John}"
}
]
}
}
}
}
}
If I play completion for "name" property, then I get automatically the default snippet played.
If I play completion for "myProperty" property, then I don't get automatically the default snippet played.