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
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
I see a parsing error in my editor (zed), but can't say much more than that. It seems that the problem is a result of the typed template function, but any line I change or remove seems to have an influence on the outcome.
Steps To Reproduce/Bad Parse Tree
exportclassTRPCErrorextendsError{constructor(opts: {message?: string;code: string}){super(opts.code);}}letsql: <T=unknown>(sqlFragments: TemplateStringsArray,
...parameters: unknown[])=>T[];constfn=(...args: unknown[])=>args;exportdefault{abc: ()=>{fn(()=>[fn(sql<never[]>`'[]'`)]);},cde: fn(async({ ctx, input })=>{newTRPCError({code: "NOT_FOUND",message: `The company was not found.`,});awaitPromise.resolve(fn([fn([{}]),fn((oc: unknown)=>oc)]));}),};exportconstfoo=`No id found.`;
Try to parse this code. Remove the line message: ``The company was not found.``, and try again. The result, I guess, should be almost the same as when having the line in place 😊
Expected Behavior/Parse Tree
Should return the same as with the deleted line, I guess.
Fixestree-sitter#329
The issue was that template call expressions only allowed primary_expression
or new_expression as the function, but instantiation expressions like
`sql<Type[]>`template`` were not supported.
This change adds $.instantiation_expression to the allowed function types
for template calls, enabling proper parsing of patterns like:
- sql<never[]>`'[]'`
- tag<string>`Hello ${name}`
- func<Type[]>`SELECT * FROM table`
Testing shows this resolves the parsing inconsistency where removing
certain lines would cause the entire file to fail parsing.
Uh oh!
There was an error while loading. Please reload this page.
Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of
tree-sitter --version
)No response
Describe the bug
I see a parsing error in my editor (zed), but can't say much more than that. It seems that the problem is a result of the typed template function, but any line I change or remove seems to have an influence on the outcome.
Steps To Reproduce/Bad Parse Tree
Try to parse this code. Remove the line
message: ``The company was not found.``,
and try again. The result, I guess, should be almost the same as when having the line in place 😊Expected Behavior/Parse Tree
Should return the same as with the deleted line, I guess.
Repro
The text was updated successfully, but these errors were encountered: