Skip to content


Syntax highlight bug when division arguments are on different lines #171

bogdan opened this Issue · 1 comment

2 participants

a = calculate(90).and_some_long_expression /
puts a

Cause 2nd and 3rd line highlighted as string(probably treat it as regexp).

Vim-Ruby member

Hmm, this is a tricky one. The problem is that there is no unambigous way to parse this without backtracking (that I can think of). This would be perfectly valid:

a = calculate(90).and_some_long_expression /
puts a

And it would mean calling and_some_long_expression with a regex as an argument... Not only that, but this:

a = calculate(90).and_some_long_expression /
  and_long_expression_here / 5
puts a

would also be perfectly valid and it would parse as two divisions...

I'm not very familiar with Vim's syntax highlighting, so maybe there is a way to differentiate, but I can't think of anything.

The particular commit that introduces this "problem" is 971d932 by @tpope. But the old version of this highlighting basically had a special case for split, scan, gsub and sub and that's not a stable solution to the issue.

I'll think about the issue some more, but I'm afraid I can't promise anything. Regexes are hard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.