alex-pinkus / tree-sitter-swift

A tree-sitter grammar for the Swift programming language.
MIT License
137 stars 35 forks source link

`lambda_expression` missing from scopes #403

Closed akaralar closed 4 months ago

akaralar commented 4 months ago

I don't understand tree-sitter that well but scope based tools give wrong results when used in Neovim (see here)

I've managed to get it to work by adding lambda_expression to locals.scm queries and removing statements from there as statements do not define a scope in Swift.

Given I have a very superficial understanding of how this all works, there are probably some reasons for why things are this way, so I wanted to ask whether it is a deliberate decision to not include lambda_expressions but include statements in scope definitions and the reasons behind it.

Thanks for all the great work!

alex-pinkus commented 4 months ago

I also have a very superficial understanding of how all this works, so you're in good company!

I don't see a good reason why lambda_expression is absent or statements is present -- I think I probably just missed the former and didn't understand the implications of the latter. Happy to switch that up.