简体   繁体   English

Sublime 3 PHP / HTML语法高亮显示

[英]Sublime 3 PHP/HTML syntax highlighting

在此输入图像描述

This image sums it up. 这个图像总结了它。 Whenever I write a PHP tag "inside" a PHP tag that ends in open brackets [if, else, for, ...], the rest of the line becomes white. 每当我在一个PHP标签“内部”写一个PHP标签时,该标签以开括号[if,else,for,...]结尾,该行的其余部分变为白色。

EDIT: @MattDMo opened an issue in Sublime github repo and seems like they already commited a fix for it. 编辑: @MattDMo在Sublime github repo中打开了一个问题,看起来他们已经提交了修复程序。 Now we just have to wait for a deploy :) 现在我们只需要等待部署:)

This problem is an issue with the PHP.sublime-syntax file in recent Sublime Text 3 builds. 这个问题是一个问题PHP.sublime-syntax近崇高的文本3构建文件。 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. 正如在这个拉取请求中所解释的那样,当PHP和HTML代码混合时,幕后会发生一些事情,特别是当HTML在大括号块内时。 The PR was accepted, and the current version of the PHP package should now work as expected. PR已被接受,PHP包的当前版本现在应该按预期工作。 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 on the dev track), change to a temp directory or someplace and run 要升级您的ST3,Build 3080或更高版本的安装(并且您真的应该使用公共测试版的当前Build 3114或开发轨道上的Build 3113 ),请更改为临时目录或某个位置并运行

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

or download the zipfile of the repo and expand it. 或者下载repo的zip文件并展开它。 Enter the created Packages directory, then copy the entire PHP folder to Sublime's Packages directory: 输入创建的Packages目录,然后将整个PHP文件夹复制到Sublime的Packages目录:

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

Please keep in mind that this will override (but not overwrite) Sublime's default PHP package, and will not be upgraded when you install a new build, with will almost certainly have additional changes as well. 记住,这将覆盖(但不会覆盖)Sublime的默认PHP包,并且在安装新版本时不会升级 ,几乎肯定会有其他更改。 Simply remember to delete the new Packages/PHP directory upon upgrade, and you'll be all set. 只需记住在升级时删除新的Packages/PHP目录,您就可以完成所有设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM