Open
Description
Did you check existing issues?
- I have read all the tree-sitter docs if it relates to using the parser
- I have searched the existing issues of tree-sitter-typescript
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version
)
No response
Describe the bug
When wrote a code snippet like this:
await f()
The tree will be
(program ; [0, 0] - [1, 0]
(expression_statement ; [0, 0] - [0, 9]
(await_expression ; [0, 0] - [0, 9]
(call_expression ; [0, 6] - [0, 9]
function: (identifier) ; [0, 6] - [0, 7]
arguments: (arguments))))) ; [0, 7] - [0, 9]
But if the function f
receives a type argument, like this
await f<T>()
The tree will be:
(program ; [0, 0] - [1, 0]
(expression_statement ; [0, 0] - [0, 12]
(call_expression ; [0, 0] - [0, 12]
function: (await_expression ; [0, 0] - [0, 7]
(identifier)) ; [0, 6] - [0, 7]
type_arguments: (type_arguments ; [0, 7] - [0, 10]
(type_identifier)) ; [0, 8] - [0, 9]
arguments: (arguments)))) ; [0, 10] - [0, 12]
The location of the node await_expression
will be in a different place in this case.
Steps To Reproduce/Bad Parse Tree
- Code snippet
await f<T>()
- The tree
(program ; [0, 0] - [1, 0]
(expression_statement ; [0, 0] - [0, 12]
(call_expression ; [0, 0] - [0, 12]
function: (await_expression ; [0, 0] - [0, 7]
(identifier)) ; [0, 6] - [0, 7]
type_arguments: (type_arguments ; [0, 7] - [0, 10]
(type_identifier)) ; [0, 8] - [0, 9]
arguments: (arguments)))) ; [0, 10] - [0, 12]
Expected Behavior/Parse Tree
(program
(expression_statement
(await_expression
(call_expression
function: (identifier)
type_arguments: (type_arguments
(type_identifier))
arguments: (arguments)))))
Repro
await f<T>()