Sublime Forum

Ruby Local Variable Syntax Highlighting

#1

I am trying to get syntax highlighting for ruby local variables working, and I can’t seem to figure it out. I believe it should be possible but i am not sure.

Here is my goal. For instance and class variables I have them highlighted in the burnt orange color (see #1). I would like the same for local variables (see #2).


Using command + option + p on the local variables, such as children or next_category_id reveals that it is in the ruby.source scope so it would seem that there is no match for it under the Ruby.tmLanguage file.

Has anyone overcome this problem? Is there an easy way to add coloring, maybe a Regex to the Ruby.tmLanguage file to recognize it? Am I overthinking this?

0 Likes

#2

An progress on this?

0 Likes

#3


This was the best I could find. It’s not perfect because of the nature of Ruby variable/method syntax, but it still gets things right the vast majority of the time.

0 Likes