How to add syntax highlighting to sublime text 2

前端 未结 2 640
粉色の甜心
粉色の甜心 2021-01-04 07:45

Given the string \"text text #{interpolation}\" Sublime Text 2 highlights the whole string with one color. I would like to highlight the interpolated text so i

相关标签:
2条回答
  • 2021-01-04 07:54

    This is better as it actually highlights the code within the interpolation as normal code, rather than all the same colour.

    <dict>
       <key>name</key>
          <string>Embedded Ruby Punctuation</string>
       <key>scope</key>
          <string>string punctuation.section.embedded.ruby</string>
       <key>settings</key>
       <dict>
          <key>foreground</key>
          <string>#F92672</string>
       </dict>
    </dict>
    <dict>
       <key>name</key>
          <string>Embedded Ruby Source</string>
       <key>scope</key>
          <string>string source.ruby.embedded.source</string>
       <key>settings</key>
       <dict>
          <key>foreground</key>
          <string>#FFFBF7</string>
       </dict>
    </dict>
    
    0 讨论(0)
  • 2021-01-04 07:55

    If you dig into the included Dawn.tmTheme file (one of the only included themes that does this highlighting properly) you'll find these highlighting rules for String embedded-source, for some reason some of the themes leave this out completely:

    <dict>
        <key>name</key>
        <string>String embedded-source</string>
        <key>scope</key>
        <string>string source</string>
        <key>settings</key>
        <dict>
            <key>background</key>
            <string>#6F8BBA26</string>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#080808</string>
        </dict>
    </dict>
    
    0 讨论(0)
提交回复
热议问题