Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime 3 PHP/HTML syntax highlighting

enter image description here

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.

EDIT: @MattDMo opened an issue in Sublime github repo and seems like they already commited a fix for it. Now we just have to wait for a deploy :)

like image 319
magroski Avatar asked Sep 16 '26 17:09

magroski


1 Answers

This problem is an 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 on the dev track), change to a temp directory or someplace and run

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

or download the zipfile of the repo and expand it. Enter the created Packages directory, then copy the entire PHP folder to Sublime's Packages directory:

  • 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 portable install - 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. Simply remember to delete the new Packages/PHP directory upon upgrade, and you'll be all set.

like image 168
MattDMo Avatar answered Sep 18 '26 07:09

MattDMo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!