BACKGROUND: In Sublime Text and Textmate, the word "class" is incorrectly highlighted when using the new ruby hash format in a Rails link_to or form field:
OBJECTIVE: Is there any way to correctly highlight the "class" keyword as it does when using the old format:
I think it's to do with the precedence in terms of syntax highlighting. Because the keywords for ruby matches "class" it is trying to highlight it as though you had class MyClass
. Whereas the old format of hashes had the preceding :
to stop it from being picked up as a keyword.
Disclaimer: I'm no expert on this stuff was just tinkering and the following worked for me.
If you edit your Ruby.tmLanguage file (in Packages/Ruby) you can move the section that defines keywords below the section that defines the new ruby 1.9 hash syntax. That way it should prioritize the new hash syntax.
Look for a <dict>
entry that contains:
<dict>
....
<key>name</key>
<string>keyword.control.ruby</string>
</dict>
and put it below the entry like:
<dict>
....
<key>name</key>
<string>constant.other.symbol.ruby.19syntax</string>
</dict>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With