4

Can I use html emmet in .php files? It works in .html files.

my settings:

{
"editor.insertSpaces": false,
"editor.tabSize": 2,
"editor.detectIndentation": false,
"editor.renderWhitespace": "none",
    "editor.renderControlCharacters": true,
    "php.validate.executablePath": "C:/xampp/php/php.exe",
    "emmet.includeLanguages": {
        "php": "html"
    },
    "emmet.showExpandedAbbreviation": "always",


}

5 Answers 5

16

These are the settings that fixed my problem

    "emmet.includeLanguages": {
        "php": "html"
    },
    "emmet.showExpandedAbbreviation": "always",
    "html-css-class-completion.enableEmmetSupport": true,
    "emmet.syntaxProfiles": {
        "php": "html"
    },
Sign up to request clarification or add additional context in comments.

2 Comments

this worked for me however "html-css-class-completion.enableEmmetSupport" was an unknown configuration property....still it works without it
One hint: settings such as 'emmet.showExpandedAbbreviation' only work when using the default profile. After switching to it, everything worked fine. Too bad as I use profiles for language support and thus need to make PHP my default.
4

I actually think you just need to enable tab completion to your settings.json

"emmet.triggerExpansionOnTab": true,

Comments

3

I had the same problem- check if have this part of code -delete this, or remove "php"

  "emmet.excludeLanguages": [
    "markdown",
    "php"
  ]

1 Comment

The original poster has included their settings, and they don't include this part.
1

The Emmet in PHP files should be enabled by default.
https://code.visualstudio.com/docs/editor/emmet

Try update to the latest version of VSCode.
Try clear out any emmet config in your user settings to let it work by default.
If it is still not working, try disable the extensions or reinstall VSCode.

Comments

0

For me, it was this setting that prevented emmet to work in PHP:

"emmet.showExpandedAbbreviation": "inMarkupAndStylesheetFilesOnly"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.