tree-sitter / tree-sitter-c-sharp

C# Grammar for tree-sitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implement top level statement support from C# 9.0

damieng opened this issue · comments

This will cause a large change in the corpus as previously we deviated from Roslyn to allow partial fragments of code to be syntax highlighted and parsed... and we did that by allowing all sorts of declarations at the top level.

Now there is a specific syntax and tree for it a lot of previously accepted-top level items will be treated differently. I expect we'll still support them all but there will be subtle changes like:

var a = Assert.Range(from, to);

On it's own will change from being a field_declaration (we treated it as if it were within a class even tho var isn't valid on a field declaration) to a local_declaration_statement just as if it were in a function.