gleam-lang / tree-sitter-gleam

🌳 A tree-sitter grammar for the Gleam programming language
Apache License 2.0
66 stars 13 forks source link

support empty case clauses to prevent parsing error #59

Closed rawhat closed 1 year ago

rawhat commented 1 year ago

The existing case_clauses requires at least one clause to parse correctly. This matches the gleam grammar, as it is required to be correct Gleam. This means, however, that indentation cannot be determined until at least some clause has been added. This is an annoyance when editing.

This PR address #57 by allowing empty case clauses. I confirmed that the existing indentation query in neovim functions as expected. Also added a test to handle both populated an un-populated case clauses. Not sure if this should just be included in an existing test case, happy to move it.