+30

Syntax highlighting of heredoc in Ruby

Benjamin Quorning 6 years ago • updated by Nieralyte 5 years ago 7
The syntax highlighting of heredocs in Ruby are missing (at least) three things:

* Interpolation is not highlighted:
<<-FOO
<p>#{can_haz_highlight_please?}</p>
FOO

* Heredoc starting without a dash is not recognized:
<<FOO
Not highlighted
FOO

* Heredocs as a method parameter mess up the closing parenthesis:
Hash.new(<<-FOO)
I don't want to write the regex for this one…
FOO

There is some documentation on heredocs here: http://blog.jayfields.com/2006/12/ruby-multiline-strings-here-doc-or.html