You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some cases unmatched_delimiter can actually interfere with tree sitter's error recovery and make things worse!
What seems to be happening is that if () is invalid R code because there isn't a condition between the two (), and in our grammar we expect the condition to be any _expression. However, an unmatched ) is considered an _expression so it gets matched here. It gets considered as part of a weird binary operator node of ) 1 + 1 where ) is the LHS, the first 1 is an unexpected error, and the second 1 is the RHS.
where now the { } is matched and tree sitter error recovery is smart enough to inject rhs: (identifier [(2, 0), (2, 0)]) which is actually a MISSING node but due to the TS bug we can't display that right rn
In some cases
unmatched_delimiter
can actually interfere with tree sitter's error recovery and make things worse!What seems to be happening is that
if ()
is invalid R code because there isn't acondition
between the two()
, and in our grammar we expect thecondition
to be any_expression
. However, an unmatched)
is considered an_expression
so it gets matched here. It gets considered as part of a weird binary operator node of) 1 + 1
where)
is the LHS, the first1
is an unexpected error, and the second1
is the RHS.It gets parsed more sensibly if you remove
unmatched_delimiter
The
condition: (identifier [(1, 6), (1, 6)])
is really aMISSING
node but the print method isn't showing that right now due to a tree-sitter bug.Here's another example that is more complex, but it makes the entire program show as an ERROR. I'm going to hide it in details because it is long
Without
unmatched_delimiter
, it is better and we get zero widthidentifier
s inserted as MISSING nodes.You can see it in the raw print method that uses their internal api, i.e. look for
(identifier (MISSING _identifier)
belowThe text was updated successfully, but these errors were encountered: