gleam-lang / tree-sitter-gleam

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

Inconsistent syntax highlighting #69

Closed deriamis closed 8 months ago

deriamis commented 11 months ago

When editing a source file, using attributes can cause odd syntax highlighting failures. For instance, using the @external attribute to mark an external function will cause the rest of the source file to be parsed incorrectly unless the function defines a fallback implementation.

A solution to this problem would likely be to attach attributes to legal parent nodes, such as functions and statement blocks. This would allow tree-sitter to more consistently "complete" a tree as soon as it matches a syntax node.

the-mikedavis commented 11 months ago

Do you have an example snippet that has this behavior? I think this may be https://github.com/gleam-lang/tree-sitter-gleam/issues/67 which was fixed on main recently

the-mikedavis commented 8 months ago

I'll close this out with #70 since I'm pretty sure it was the same as #67 and the fix for #67 has been released in a few tags. We can re-open or create a new issue though if you're still seeing this