tree-sitter / tree-sitter-c-sharp

C# Grammar for tree-sitter
MIT License
177 stars 47 forks source link

Fix wrong parsing when a function call with a (one or more) variable … #327

Open Sveder opened 3 months ago

Sveder commented 3 months ago

…is inside a using statement. Instead of being parsed as invocation_expression it is being parsed as variable_declaration because of tuple_pattern.

Sveder commented 3 months ago

Might be an acceptable fix for: https://github.com/tree-sitter/tree-sitter-c-sharp/issues/326

damieng commented 2 months ago

So while it solves one individual issue this breaks things by renaming variable_declaration to using_variable_declaration (and the same for declarators). Sometimes we'll take that break where we're better matching the Roslyn grammar/official C# syntax but they don't the using prefix either.

Best option here might be to see if you can keep the new using patterns but alias them so they don't have the using prefix (there are some examples in the grammar).

Sveder commented 2 months ago

@damieng @tamasvajk First of all, thanks for taking a look. Much appreciated. Second of all, some of your questions are somewhat over my head. I'm definitely not a C#/Roslyn expert (yet :)). I'd love some of your guidance in how to fix this better.