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

Joa*_*los 5 html php phpstorm

我在PHPStorm中遇到问题,当它与HTML代码混合时,它不会突出显示.php文件中的PHP代码(但会智能感知它).

截图(点击放大):

截图

如果我使缓存/重启无效,它会在几秒钟内显示正确的突出显示.但是,在"计算"之后,它将返回不突出显示它.

这有什么设置吗?或者它只是一个普通的错误?

我已经阅读了有关语言注入的内容,但这似乎不适合它,因为它已经是.php文件而且PHP不在注入语言列表中.

相关代码:

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

<html>
<body>

<script>
    var shouldStillWorkAfterThis = true;
</script>

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

<table>
    <tr>
        <td><?php $works = "yes"; ?></td>
    </tr>
</table>

<!-- lets try split syntax -->
<?php
if ($works) {
    ?>
    <table>
        <tr>
            <td><?= $works ?></td>
        </tr>
    </table>
    <?php $thisShouldToo = true; ?>
<?php } ?>

<!-- lets break it -->
<div id="someclass">
    <header>
        <div class="someotherclass">
            <div class="andanextraclass">
                <!-- include a file-->
                <?php include('somefile.php');?>
                <?php
                    $anythingHereIsNowBroken = true;
                ?>
            </div>
        </div>
    </header>
</div>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

语言注入设置:

语言注射

我在MacOSX 10.9.5上使用PhpStorm 8.0.3.

Laz*_*One 12

根据你的截图Settings (Preferences on Mac) | Editor | Language Injections.

请从底部删除第3语言注入规则("div" - 在Scope列中有"IDE").

该规则将HTML注入到div标记中,该标记告诉IDE将此类标记内的所有其他代码(甚至PHP)视为HTML /纯文本.