0
votes

I am using Sublime Text 3, build 3114. It should be the latest version available today. Before installing this update, the JavaScript code was highlighted correctly when using PHP in this context. Now I am losing all the syntax highlight functions for JavaScript unless I close and re-open the tag <script>in the flow.

Here is a screen shot of the issue I'm having (I just wrote a few random lines to give the idea): Sublime Text 3 Syntax Highlighter breaks using PHP in JS context

The last call of the removeClass method in the function myFuncTwo has lost the syntax highlighter because I used <?php echo $id; ?> in the line above. Any lines of JS code below the PHP, even outside the JS function, will not be highlighted. If I closed the </script> tag and I re-opened it, the syntax highlighter would start working again.

Has anyone faced this issue? Is there anything I can do for the PHP Highlighter? I haven't modified any theme files and I am using the default theme Twilight. Also, the syntax highlighting is set to PHP because the file contains mostly PHP code, JS and HTML. If I set it to 'JavaScript', then the syntax highlighter would ignore the PHP code by giving it the green color of "test" there in that line.

Thanks a lot for sharing your thoughts!

1
possible duplicate of stackoverflow.com/questions/37586887/…. Upgrading to Dev Build 3118 will fix the problem sublimetext.com/3devKeith Hall
@KeithHall thank you. Sorry but I missed that and it did not come up in the suggested questions while I was posting it. Upgrading did fix the problem!Alessio Firenze

1 Answers

1
votes

Close the javascript and concatenate, like this:

removeClass("test" + <?php echo $id; ?>);