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
(object_definition object body: (identifier)
(template_body :
(given_definition given return_type: (type_identifier) =
body:
(instance_expression new arguments: (type_identifier)
(template_body :
(function_definition def name: (identifier) = body: (string))
end _end_ident)))
end new end given))
end _end_ident
What do you expect the tree to look like
There is no ERROR node, but I strongly believe that the end clause of a given node should be captured as a child of that node (or some similar construct).
Particularly, looking at the second last line of the output, we can see that end new and end given are siblings. Meanwhile, the code suggests that new block is a child of the given block.
The improper grouping of the end clauses makes it so that a lot more of the parse tree has to be examined to find the proper indentation for that end clause.
For instance, you have to check if you're not already correctly indented by checking if the previous sibling is a matching block to the end clause. But since multiple nested end clauses are just represented as sibling nodes, you have to walk through all the previous children, and then you go one level up and so on.
Where are you experiencing this error?
treesit (GNU Emacs 29+)
The text was updated successfully, but these errors were encountered:
Digging a bit more into it, it seems like nesting isn't the actual problem, as in some places that does work fine (nesting vals, within an object etc).
So, starting with looking at the given_definition and instance_expression might be a viable option.
Commit of tree-sitter-scala you tested this on
236c7b2
A code sample showing the error
Show the error node
What do you expect the tree to look like
There is no ERROR node, but I strongly believe that the
end
clause of a given node should be captured as a child of that node (or some similar construct).Particularly, looking at the second last line of the output, we can see that
end new
andend given
are siblings. Meanwhile, the code suggests thatnew
block is a child of thegiven
block.The improper grouping of the
end
clauses makes it so that a lot more of the parse tree has to be examined to find the proper indentation for thatend
clause.For instance, you have to check if you're not already correctly indented by checking if the previous sibling is a matching block to the
end
clause. But since multiple nestedend
clauses are just represented as sibling nodes, you have to walk through all the previous children, and then you go one level up and so on.Where are you experiencing this error?
treesit (GNU Emacs 29+)
The text was updated successfully, but these errors were encountered: