Home Download Buy Blog Forum Support

Key for adding coloring to string interpolation

Key for adding coloring to string interpolation

Postby ryanlecompte on Sat Jan 07, 2012 6:45 pm

Hey guys!

Does anyone know if it's possible to specify a key in the tmBundle's (for example, for Monokai) that would make the "#{foo}" show up as a different color in a string?

s = "Hello there #{foo} how are you?"

That would be helpful for spotting string interpolations. Right now the string has the same color regardless of whether or not it has substitutions.

Thanks!
ryanlecompte
 
Posts: 20
Joined: Wed Dec 28, 2011 2:16 pm

Re: Key for adding coloring to string interpolation

Postby ryanlecompte on Sat Jan 07, 2012 6:48 pm

Actually, to be more specific, I just want the #{} characters to have a specific color, not the text within.

Thanks!
ryanlecompte
 
Posts: 20
Joined: Wed Dec 28, 2011 2:16 pm

Re: Key for adding coloring to string interpolation

Postby sublimator on Sun Jan 08, 2012 12:41 am

Code: Select all
<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>


You could add a section like that to the `Packages\Color Scheme - Default\Monokai.tmTheme` file, adjusting color to taste.
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: Key for adding coloring to string interpolation

Postby ryanlecompte on Sun Jan 08, 2012 6:29 am

That worked great, thanks!
ryanlecompte
 
Posts: 20
Joined: Wed Dec 28, 2011 2:16 pm


Return to General Discussion

Who is online

Users browsing this forum: meigallodixital and 13 guests