Sublime 3 PHP/HTML 语法高亮

Sublime 3 PHP/HTML syntax highlighting

这张图片总结了它。每当我写一个 PHP 标签 "inside" 一个 PHP 以开括号结尾的标签 [if, else, for, ...],该行的其余部分变为白色。

编辑: @MattDMo 在 Sublime github 回购中提出了一个问题,看起来他们已经提交了修复程序。现在我们只需要等待部署 :)

此问题是 issue with the PHP.sublime-syntax file in recent Sublime Text 3 builds. As explained in this pull request, there are some things going on behind the scenes when PHP and HTML code mix, especially when HTML is inside of a curly brace block. The PR was accepted, and the current version of the PHP package should now work as expected. To upgrade your installation of ST3, Build 3080 or later (and you really should be using the current Build 3114 of the public beta, or Build 3113 在开发轨道上),更改到临时目录或某个地方并 运行

git clone https://github.com/sublimehq/Packages.git

或者下载 repo 的 zipfile 并展开它。进入创建的Packages目录,然后将整个PHP文件夹复制到Sublime的Packages目录:

  • OSX - ~/Library/Application Support/Sublime Text 3/Packages
  • Linux - ~/.config/sublime-text-3/Packages
  • Windows - C:\Users\UserName\AppData\Roaming\Sublime Text 3\Packages
  • Windows 便携式安装 - InstallationDirectory\Data\Packages

记住这将覆盖(但不是覆盖)Sublime 的默认 PHP 包,并且 安装新版本时不会升级,几乎肯定还会有其他更改。只需记得在升级时删除新的 Packages/PHP 目录,一切就绪。