【问题标题】:How do I change color of the class properties in Sublime text 2?如何更改 Sublime text 2 中类属性的颜色?
【发布时间】:2012-05-31 11:38:01
【问题描述】:

目前这是突出显示所有变量的代码,包括类属性(它们是红色的):

    <dict>
        <key>name</key>
        <string>Variables</string>
        <key>scope</key>
        <string>variable, support.variable</string>
        <key>settings</key>
        <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#dc322f</string>
        </dict>
    </dict>

如何只更改类属性的颜色?

$object-&gt;property = 'xxx';

所以$object 应该仍然是红色的,但我希望property 有不同的颜色

【问题讨论】:

    标签: php syntax-highlighting sublimetext sublimetext2


    【解决方案1】:

    variable.other.property 应该可以解决问题:

    <dict>
        <key>name</key>
        <string>Variables</string>
        <key>scope</key>
        <string>variable.other.property</string>
        <key>settings</key>
        <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#00ff00</string>
        </dict>
    </dict>
    

    【讨论】:

    • @Alex:您能否举例说明其他类型的关键字也发生了变化?
    • 它还突出显示变量,如$this-&gt;$something。 $something 应该像普通变量一样突出显示,因为它就是这样
    【解决方案2】:

    变化:

    <string>variable, support.variable</string>
    

    收件人:

    <string>variable.other.property</string>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-17
      • 1970-01-01
      • 1970-01-01
      • 2012-04-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多