3

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 :)

6
  • 1
    ask on superuser.com Commented May 31, 2016 at 18:55
  • @PedroLobito From What topics can I ask about here? in the help center, software questions are allowed if they cover "[...] software tools commonly used by programmers". Sublime Text, like vim, emacs, Notepad++, etc., is a programming editor, and there are tens of thousands of questions about them on this site that are perfectly on-topic. Commented May 31, 2016 at 22:13
  • This seems to be a bug with the PHP syntax highlighting definition. I'll open a new issue momentarily. I can't think of a viable workaround at this point. Commented May 31, 2016 at 22:20
  • 2
    I've added a reference to this existing issue in the sublimehq/Packages repo. I know that the syntax definitions are under active development, so hopefully they can work something out. If anyone is good with sublime-syntax files and wants to submit a PR, please feel free. Commented May 31, 2016 at 23:17
  • @MattDMo seems like they took your issue seriously and already commited a fix for it! Thanks for everything! Commented Jun 1, 2016 at 13:01

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

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.