简体   繁体   English

PHPStorm-Javascript语法突出显示在php文件中不起作用

[英]PHPStorm - Javascript syntax highlighting not working in php files

The files in question are .php and not unusually they mostly consist of html and javascript with a little bit of php at the top. 有问题的文件是.php,并且它们通常由html和javascript组成,顶部有一点点php。 I've noticed that PHPStorm doesn't highlight javascript syntax errors in php files. 我注意到PHPStorm不会在php文件中突出显示javascript语法错误。 If I put the exact same code in a .html file it highlights errors as it should. 如果我将完全相同的代码放在.html文件中,它将突出显示应有的错误。 I've tried setting the php files in question as HTML in settings > template data language but it doesn't help. 我试过在设置>模板数据语言中将有问题的php文件设置为HTML,但这无济于事。 I could set all the pages to have .html exts (as this the only thing that works) but then I lose my php formatting and syntax checking. 我可以将所有页面设置为具有.html exts(因为这是唯一起作用的东西),但是随后我丢失了php格式和语法检查。 I'm using PHPStorm 8.0.2. 我正在使用PHPStorm 8.0.2。 This seems like a bug. 这似乎是一个错误。 How do I fix this? 我该如何解决?

Save the file as .php and then specify JavaScript as a secondary language by going to Settings >> Template Data Languages 将文件另存为.php,然后通过转到设置 >> 模板数据语言将JavaScript指定为辅助语言

Syntax highlighting of PHP inside JavaScript (and other languages) JavaScript(和其他语言)中的PHP语法高亮显示

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

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