VS Code php tag autocomplete

Mezotar picture Mezotar · Apr 30, 2017 · Viewed 24.5k times · Source

kind of trivial question but here it goes. I can't figure out why VS Code autocompletes (with tab) all html tags correctly while php tag not. When i type "php" and hit tab, it creates this:

<php></php>

which is useless and i have no idea why it's there. I want it to do normal php tag

<?php ?>

I have turned off suggestions as they were distracting me. Anyway to edit default/top "tab autocomplete" item?

Answer

Lane picture Lane · Aug 29, 2017

this hack worked for me: go to 'Preferences: Open User Snippets', and paste this snippet into the html (yes, that's html) user snippets:

"php": {
    "prefix": "php",
    "body": [
        "<?php $1 ?>"
    ],
    "description": "php tag"
}