简体   繁体   English

sublimetext3-php文件中的js语法损坏

[英]sublimetext3 - broken js syntax in php file

Sublime Text - Version 3.0, Build 3143 Sublime Text-版本3.0,内部版本3143

I deal with a lot of php files that contain HTML, CSS and JavaScript. 我处理了很多包含HTML,CSS和JavaScript的php文件。 The only problem I've found so far is when I'm looking at script tags in a PHP file. 到目前为止,我发现的唯一问题是查看PHP文件中的脚本标签时。 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?) 语法设置为PHP,但是JS函数之外的注释破坏了它下面的其余代码(看起来像是在尝试检测正则表达式?)

语法不完整

When I move the // test comment into the function then all is well: 当我将// test注释移到函数中时,一切都很好:

正确的语法

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 type="text/javascript"到脚本标签无法解决任何问题

My finger points to the PHP syntax highlighting ... but if that's the case, how can this be fixed? 我的手指指向了PHP语法高亮显示...但是如果是这种情况,如何解决?

Fresh install of Build 3143(Windows), opened as "PHP" and everything works. 全新安装的Build 3143(Windows),以“ PHP”打开,一切正常。 It can be caused by some custom settings you made or third party plugin. 这可能是由您进行的某些自定义设置或第三方插件引起的。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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