html phpstorm 生成,与HTML混合时,PhpStorm不会突出显示.php文件中的PHP代码

I am having a problem in PHPStorm where it won't highlight PHP code (but will intellisense it) inside a .php file when it's mixed with HTML code.

Screenshot (click to enlarge):

ee28e506ac9e8c89cc526de237230f6f.png

If I invalidate cache/restart, it will, for a few seconds, show the correct highlighting. However, after it "calculates", it will return to not highlighting it.

Is there a setting for this? Or is it just a plain bug?

I have read about language injections, but this does not seem like the place for it since it's a .php file already and PHP is not on the list of injectable languages.

Relevant code:

$works = "yes";

?>

var shouldStillWorkAfterThis = true;

$works = "yes";

?>

<?php $works = "yes"; ?>

if ($works) {

?>

= $works ?>

$anythingHereIsNowBroken = true;

?>

Language Injections Settings:

3650c05dc9ab0301de45033aa3a08ed7.png

I am using PhpStorm 8.0.3 on MacOSX 10.9.5.

解决方案

Based on your screenshot of Settings (Preferences on Mac) | Editor | Language Injections.

Please delete 3rd language injection rule from the bottom (the one for "div" -- that has "IDE" in Scope column).

That rule injects HTML into div tag which tells IDE to treat all other code (even PHP) inside such tag as HTML/plain text.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值