简体   繁体   English

Sublime文本中的PHP语法突出显示

[英]PHP Syntax Highlight in Sublime Text

I've got issues with syntax highlighting in following cases: 我在以下情况下遇到语法突出显示的问题:

在此输入图像描述

How can I get variables highlighted when mixed with strings? 如何在与字符串混合时突出显示变量?

You just need to have a color scheme that has the correct scopes. 您只需要具有正确范围的配色方案。 For example, this is how similar code looks like using the Neon Color Scheme : 例如,这是使用霓虹色方案的类似代码的样子:

PHP $ var in string

I use this kind of highlight: 我使用这种亮点: 在此输入图像描述

It helps me a lot when php code is together with other html code. 当php代码与其他html代码一起使用时,它对我有很大的帮助。

You have to edit your theme .tmTheme file, as mine is Monokay.tmTheme so right after the </array> command i used the code above: 你必须编辑你的主题.tmTheme文件,因为我的是Monokay.tmTheme所以在</array>命令之后我使用了上面的代码:

    <dict>
        <key>scope</key>
        <string>punctuation.section.embedded.begin.php</string>
        <key>settings</key>
        <dict>
            <key>foreground</key>
            <string>#FF0000</string>
        </dict>
    </dict>

    <dict>
        <key>scope</key>
        <string>punctuation.section.embedded.end.php</string>
        <key>settings</key>
        <dict>
            <key>foreground</key>
            <string>#FF0000</string>
        </dict>
    </dict>

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

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