简体   繁体   中英

sublimetext3 - broken js syntax in php file

Sublime Text - Version 3.0, Build 3143

I deal with a lot of php files that contain HTML, CSS and JavaScript. The only problem I've found so far is when I'm looking at script tags in a PHP file. The syntax is set to PHP but comments outside of JS functions break the rest of the code below it (it looks like it's trying to detect regex?)

语法不完整

When I move the // test comment into the function then all is well:

正确的语法

I'm curious to know where the problem exists and maybe find a fix.

  • Color Scheme doesn't affect the syntax highlighting (it still breaks in other color schemes)
  • Adding type="text/javascript" to the script tag doesn't fix anything

My finger points to the PHP syntax highlighting ... but if that's the case, how can this be fixed?

Fresh install of Build 3143(Windows), opened as "PHP" and everything works. It can be caused by some custom settings you made or third party plugin.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM