tree-sitter / tree-sitter-ruby

Ruby grammar for tree-sitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incomplete method definition parses as if it ends on the first line

dgutov opened this issue · comments

The file contents like:

def foo
|

(| denotes the cursor)

parse without error to structure

(program
 (method def body: (identifier) end))

which on its own is a bit surprising (a virtual "end"?), but the really unfortunate part is that the end of the parsed node is put on the first line, thus the second line is essentially said to be outside of the method (as any straightforward analyzer of the parse tree would conclude). Which makes things more difficult for indentation code.

Could we position the "virtual end" at the end of the file in this example?