Home php Auto Filling PHP code in Visual Studio Code

Auto Filling PHP code in Visual Studio Code

Author

Date

Category

I have such a problem – I work in the VS-Code with PHP. Previously, working in Sublime Text I can simply enter a “PHP” and click Tab, after which I was revealed by PHP tag. In VS-Code, this can not be done. What could be the problem?


Answer 1

In Vscode it works differently. There are no such a tip from the box and you must add it manually.

Open File - Preferences - User Snippets and select the settings file for the desired language, such as PlainText.

Add the next code there before the closing curly bracket:

"php": {
    "PREFIX": "PHP",
    "BODY": [
    "& lt;? php $ 1? & gt;"
    ],
  "Description": "Expand PHP Tags"
}

Save the settings and restart Vscode. After that, the hint will work.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions