String interpolation highlighting (was Re: rubyFunction, rubyClass, and rubyModule no longer highlighted)

Nikolai Weibull now at
Mon Feb 26 11:44:56 EST 2007

On 2/26/07, Tim Pope <vim-ruby-devel at> wrote:
> On Mon, Feb 26, 2007 at 08:56:47PM +1100, Doug Kearns wrote:
> > FWIW, I suspect that some of the highlighting will break when in an
> > interpolation region since it makes assumptions about what can appear
> > before and after syntax 'elements'.  When I wrote these I didn't do so
> > with this new addition in mind.  Have you come across any yet?
> No, but it didn't take much searching:
> "#{if true then 1 end}"
> However, syntax highlighting also fails on
> 3.times { if true then 1 end }
> Of these two, the latter is more serious because it affects future end
> highlighting.
> Adding { to the monster regexp setting off if/unless does not fix
> this.  Apparently Vim doesn't like backtracking through the beginning
> of a region definition.  I'll investigate a bit more; let me know if
> you have any ideas.

Uh, oh.  It sounds as if we're going overboard here.  Sorry, no ideas,
just complaints.  Still, it's going to be very hard to match every
weird part of the Ruby grammar, so optimizing for the common cases
makes things a lot easier.  I'm sure there's code out there that
actually contains the line "#{if true then 1 end}", but I don't see
why we should try so damn hard to match it beyond matching the
delimiters.  If you're silly enough to put a lot of junk in your
string interpolations, then syntax highlighting isn't really going to
help you much.


More information about the vim-ruby-devel mailing list