Reputation: 75
Since VSCode doesn't seem to feature autocompletion for if, elseif, etc for javascript, php and maybe even more, I wanted to create myself snippets to get around that.
The snippet:
{
"If": {
"scope": "javascript,typescript,php",
"prefix": "if",
"body": [
"if ( ${1:true} ) {",
"\t${2:/// code}",
"}"
],
"description": "generic if statement"
}
}
Tab completion in php works as expected in javascript however it doesn't work at all.
Why is that?
UPDATE:
I have already figured out that there are default snippets for "if" and "ifelse".
The very top one is my snippet.
The build-in ones I have hidden from IntelliSense, so that they are not in the way. But as I said, this is just working for php, not javascript.
Removing my snippet and unhiding the build-in ones just causes that no if-snippet works anymore, not even php. That is the reason why I assumed that vscode has no if-completion support in the first place.
No matter how I put it, it never works :shrug:
Upvotes: 0
Views: 176
Reputation: 21
VSCode has default snippets for many languages. See the default ones by pressing:
Shift + Cmnd + P
or Shift + Ctrl + P
on PC and typing Insert Snippet
Seems like if is already reserved for one of those in JavaScript.
Upvotes: 1