Emmet 自动完成不适用于 Sublime 中的 php 个文件(扩展缩写)

Emmet autocomplete is not working for php files in Sublime (Expand abbreviations)

我在 Sublime 中为 HTML 文件使用 Emmet 插件。但是当我想在 PHP 文件中键入 HTML 代码时,就像 Laravel 中的视图文件一样,Emmet 不会扩展缩写。

例如:当我在 Sublime 中的 HTML 文件中键入 html:5 并按 Tab 键时,Emmet 自动完成会将其转换为:

<!DOCTYPE html>
  <html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Document</title>
  </head>
  <body>

  </body>
</html>

但是当我在扩展名为 .php 的文件中执行相同操作并按 Tab 键时,什么也不会发生。这是一个 sublime 配置问题,还是有任何解决方案可以在 Sublime 中使用 Emmet 为 PHP 文件快速键入 HTML 代码?

Emmet Package Control page 中的自述文件清楚地解释了如何执行此操作 - 向下滚动到 How to expand abbreviations with Tab in other syntaxes 部分:

Emmet expands abbreviations in limited syntaxes only: HTML, CSS, LESS, SCSS, Stylus and PostCSS. The reason to restrict Tab handler to a limited syntax list is because it breaks native Sublime Text snippets.

If you want to abbreviation with Tab in other syntaxes (for example, JSX, HAML etc.) you have to tweak your keyboard shorcuts settings: add expand_abbreviation_by_tab command for tab key for required syntax scope selectors. To get current syntax scope selector, press ⇧⌃P (OSX) or Ctrl+Alt+Shift+P, it will be displayed in editor status bar.

Go to Preferences > Key Bindings — User and insert the following JSON snippet with properly configured scope selector instead of SCOPE_SELECTOR token:

{
  "keys": ["tab"], 
  "command": "expand_abbreviation_by_tab", 

  // put comma-separated syntax selectors for which 
  // you want to expandEmmet abbreviations into "operand" key 
  // instead of SCOPE_SELECTOR.
  // Examples: source.js, text.html - source
  "context": [
    {
      "operand": "SCOPE_SELECTOR", 
      "operator": "equal", 
      "match_all": true, 
      "key": "selector"
    }, 

    // run only if there's no selected text
    {
      "match_all": true, 
      "key": "selection_empty"
    },

    // don't work if there are active tabstops
    {
      "operator": "equal", 
      "operand": false, 
      "match_all": true, 
      "key": "has_next_field"
    }, 

    // don't work if completion popup is visible and you
    // want to insert completion with Tab. If you want to
    // expand Emmet with Tab even if popup is visible -- 
    // remove this section
    {
      "operand": false, 
      "operator": "equal", 
      "match_all": true, 
      "key": "auto_complete_visible"
    }, 
    {
      "match_all": true, 
      "key": "is_abbreviation"
    }
  ]
}

PHP 的 SCOPE_SELECTOR 值为 embedding.php text.html.basic