Sublime Forum

Syntax highlighting within PHP HEREDOC not working

#1

Syntax highlighting does not work in a .php page within HEREDOC for (at least) CSS and JAVASCRIPT. See below images.

Am I doing something wrong? Or is this not supported? Could it be fixed in a future release? Thanks for your help! Sublime2 is amazing, I’m in the process of switching our entire company from Textmate to Sublime.



0 Likes

#2

Can anyone help with this? Is there another place where technical support is provided for ST2? Am I asking in the wrong place?

0 Likes

#3

All the syntax highlighting is provided by Textmate syntax definitions, and thus not directly controlled by Sublime Text. Several of the definitions, among those PHP, are a bit out of date and should be updated at some point.

I have updated myself and get reasonable heredoc highlighting, like this:
https://img.skitch.com/20120312-j3hr4m8ip1ersdhyyu6f2ca92h.png

As you can see, the css highlighting is wrong in both cases.

Anyways, if you want to try updating you can find the latest Textmate syntax here: github.com/textmate/php.tmbundl … r/Syntaxes

Also note that the syntax indicator in the lower right will not change if the embedded syntax changes.

0 Likes

#4

Thanks so much for your response. I didn’t realize that ST2 was using Textmate syntax definitions, and out-of-date ones at that, apparently. Updating from the link you provided improved it somewhat, but the Javascript still seems significantly off.

Correct me if I’m wrong, but shouldn’t ST2 be able to detect the HEREDOC and just switch completely to a different syntax within the block? I just switched recently from Textmate, and Textmate was able to do this without a problem.

0 Likes

#5

I just realized that updating to the latest Textmate php language bundle made it so that some .php files are no longer being viewed with the correct syntax highlighting, instead they’re viewed as plain text, see:


So I need to revert to the php language bundle that came with ST2, but this means I lose the improvement in HEREDOC syntax highlighting.

Is there a solution for this? Does the application developer/s provide technical support for this product? How do we get help? Is it only through this forum? Should I be asking somewhere else?

Thanks to anyone who can help!

0 Likes