gleam-lang / tree-sitter-gleam

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

panic() cause a syntax highlight issue on nvim and hx #82

Closed acidiney closed 8 months ago

acidiney commented 8 months ago

Hey, when utilizing the panic() function within code files in nvim and hx editors, a syntax highlighting issue occurs as you can see in image below: image

If I change panic() to panic as "Error" everything looks fine: image

Thanks

the-mikedavis commented 8 months ago

Is panic(msg) valid syntax or deprecated? I see a comment here about the same syntax for todo being deprecated: https://github.com/gleam-lang/tree-sitter-gleam/blob/2012f294baacf30e7a62414754021284377366c6/grammar.js#L348-L360

lpil commented 8 months ago

It's valid syntax. It's a panic expression being used as a function call. It's clearly incorrect code, but it's syntactically valid.

It's equivalent to this

let x = panic
x("...")