Sublime Forum

Syntax highlighting for Ruby vars embedded in double quotes

#1

Does anyone know how to edit the Ruby.tmLanguage file so that embedded vars show up as vars?

This is what it looks like now

This is what I’d like it look like

If it helps, a CTRL+ALT+SHIFT+P gives this as the context
source.ruby string.quoted.double.ruby source.ruby.embedded.source

Any ideas? I mean other than taking a huge chunk of time, reverse engineering the format and eventually getting it through much trial and error. I’d like to avoid that if possible or at the very least prolong it to when I actually have the time to spare.

Any help is appreciated.

Thanks all,
NaTePo

0 Likes

#2

look here https://forum.sublimetext.com/t/ruby-highlighting/4315/1&hilit=ruby+syntax#p23006

0 Likes

#3

Excellent! That got me half way there as the vars were still the same colour as the text but it was easy enough to figure out the rest.

I added the following to my Monokai.tmTheme file,

		<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>

…and that got me all the way there.

Many thanks vitaLee.
Bonus appreciation for not pointing out my idiocy in not finding that post myself.

NaTePo

0 Likes