ruby-lsp
ruby-lsp copied to clipboard
Syntax highlighting fails when using methods called named after ruby keywords
Defining or using methods named after ruby keywords which use the <keyword> [...] end syntax (like while [...] end or def xxx [...] end) breaks the syntax highlighting.
Some examples:
Using methods named end
foo = Range.new(1, 10)
foo.end
def bar
bar = Range.new(1, 10)
bar.end
end
def end
puts "Hello World"
end
self.end
Using methods named def
This code snippet is invalid ruby code, I just wanted to show that the syntax highlighting matches thinks the self.def and the last end belong together.
def def
puts "foo"
end
self.def
def bar
puts "bar"
end
end
Using methods named while
def while
end
a = 1
while a < 2
puts a
a += 1
end
Using classes named End
class End
def foo
puts "foo"
end
end
End.new.foo