Skip to content

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

@dgutov

Description

@dgutov

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions