Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent syntax highlighting #69

Closed
deriamis opened this issue Sep 19, 2023 · 2 comments
Closed

Inconsistent syntax highlighting #69

deriamis opened this issue Sep 19, 2023 · 2 comments

Comments

@deriamis
Copy link

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.

deriamis added a commit to deriamis/tree-sitter-gleam that referenced this issue Sep 19, 2023
In the previous version of the grammar, attributes essentially "floated"
in the tree, meaning they were not actually attached to anything. This
was causing odd issues with syntax highlighting, such as external
functions marked with an `@external` attribute causing subsequent
syntax highlighting to fail in source files. This commit attaches
attribute nodes only to legal parent nodes (functions and statement
blocks) to make syntax highlighting more consistent.

Closes gleam-lang#69
@the-mikedavis
Copy link
Member

Do you have an example snippet that has this behavior? I think this may be #67 which was fixed on main recently

@the-mikedavis
Copy link
Member

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

@the-mikedavis the-mikedavis closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants