Distinguishing Ruby def/end and do/end for syntax highlighting


Is there a straight-forward way to distinguish the end in def ... end from that in do ... end for the purposes of syntax highlighting? According to DevTools they share the same CSS selector, which is about as deep as I’ve ever gone when customizing syntax highlighting.

An example of what I’d like to achieve (in VIM):


This can be done, but not in a straightforward manner. In order to give the two different css classes (so that you can highlight them differently), you would need to update the ruby grammar in https://github.com/atom/language-ruby/blob/master/grammars/ruby.cson

Unfortunately, the current syntax highlighting for ruby is rather barebones. It works fine for the 90%, but it’s not perfect. I would fix it, but I’m not too familiar with the cson language grammars. (or with tokenizing/parsing/lexing in general)


I’m not very familiar with the cson grammars either. I’m willing to hack away at it, but I’m also not having much luck finding relevant documentation. (it doesn’t appear to exist in the official docs, at least). If someone with relevant expertise can point me in the right direction, I’m glad to do the rest. I have a suspicion this is not a simple grammar update, because I’m assuming it would require some kind of bracket matching logic that may not be handled in the cson grammars themselves. It’s also possible I’m overthinking this.