hedgehog90
hedgehog90

Reputation: 1511

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?

Upvotes: 4

Views: 3694

Answers (1)

Brock Amhurst
Brock Amhurst

Reputation: 497

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)

Upvotes: 3

Related Questions