tree-sitter / tree-sitter-c-sharp

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

Add `type` fields #316

Closed tamasvajk closed 1 year ago

damieng commented 1 year ago

As I've said before, I'm not a big fan of making all elements in a simple list fields. The main reason is that it makes parse trees more verbose and more difficult to read, something one has to do quite often when developing queries. It also goes against my intuition that things are either like records (each field appears at most once) or like collections (all things are similar). I see that it does allow for blanket queries such as (_ type: (_)). And, given that @damieng agrees with this change, I'm not going to block it.

My experience is mostly with the parsing and tree-sitter side so I when it comes to fields and other magic to light up GH Semantic I'll defer to others.

tamasvajk commented 1 year ago

I've removed the two cases where field names were added in simple lists. I don't have a strong feeling about these, so let's go with the non questionable field names first, and then if we see value in having the others, we'll add them.

I also added some more highlighting test cases to cover the type lists (base list, and type argument list).