0

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!

2
  • 1
    possible duplicate of stackoverflow.com/questions/37586887/…. Upgrading to Dev Build 3118 will fix the problem sublimetext.com/3dev Commented Jul 12, 2016 at 12:39
  • @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! Commented Jul 12, 2016 at 12:51

1 Answer 1

1

Close the javascript and concatenate, like this:

removeClass("test" + <?php echo $id; ?>);
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.