VS code: 1.28.1
Mac OS High Sierra 10.13.6
I have created a custom snippet to add interpolation in HTML file. it works fine when using F1 >insert snippet way But I need to add keybinding so that it works with keyboards. here what I have done but it does not work.
create a snippet with help of vs code tutorial
{
"interpolate": {
"prefix": "inter",
"body": ["{{ ${CLIPBOARD} |json }}"],
"description": "Interpolate this"
}
}
Now I need to bind with the key shortcut and add this in keybindings.json
{
"key": "shift+cmd+i",
"command": "editor.action.interpolate",
"when": "editorTextFocus",
"args": {
"langId": "html",
"name": "interpolate"
}
}
But whenever I hit Cmd+Shift+I. throw error
"command 'editor.action.interpolate' not found
What I am doing wrong here?
find the solution, we need to add the value of name in keybindings.json same as the key of user snippet file html.json
{
"interpolate": { // this is the name of snippet
"prefix": "inter",
"body": ["{{ ${CLIPBOARD} |json }}"],
"description": "Interpolate this"
}
}
{
"key": "shift+cmd+I",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"langId": "html",
"name": "interpolate" << same as name of snippet
}
}