How to add syntax highlighting to sublime text 2

Given the line "text text #{interpolation}" Sublime Text 2 highlights the entire line in one color. I would like to highlight the interpolated text, so it's easy to select. When I press ctrl-shift-alt-p in the interpolated section, Sublime tells me the namespace: source.ruby string.quoted.double.ruby source.ruby.embedded.source

I am wondering where I would define a rule to highlight this (I think in the tmLanguage file), in what format this rule will accept and how to assign a color to it.

+13
ruby sublimetext2
Feb 21 '13 at 18:49
source share
2 answers

If you delve into the attached Dawn.tmTheme file (one of those included that makes this selection properly), you will find these highlighting rules for String embedded-source , for some reason some of the topics completely exclude this:

 <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> 
+10
Feb 21 '13 at 19:40
source share

This is better because it actually underlines the code inside the interpolation as a regular code, rather than all the same color.

 <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> 
+6
Jul 10 '13 at 9:54 on
source share



All Articles