简体   繁体   中英

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. I've noticed that PHPStorm doesn't highlight javascript syntax errors in php files. If I put the exact same code in a .html file it highlights errors as it should. I've tried setting the php files in question as HTML in settings > template data language but it doesn't help. 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. I'm using 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

Syntax highlighting of PHP inside JavaScript (and other languages)

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