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

Support special attributes :let, :for, :stream #16

Merged
merged 5 commits into from
Jun 13, 2022

Conversation

connorlay
Copy link
Member

@connorlay connorlay commented Jun 12, 2022

Adds supports for HEEx special attributes: :let, :for, and :stream.

A new node has been added to the grammar, special_attribute, that behaves similarly to the attribute node with the following changes:

  • a special_attribute must have a corresponding expression node.
  • a special_attribute can only be added to the following tags: start_component, start_slot, start_tag, and self_closing_tag.
  • a special_attribute_name can only be one of the following values (more could be added in the future): let, for, stream.
  • a special_attribute_name is highlighted as keyword

This PR also adds the prettier code formatter with configuration borrowed from tree-sitter-elixir.

josevalim
josevalim previously approved these changes Jun 12, 2022
@connorlay connorlay force-pushed the clay-special-attributes branch from 3ebaa53 to 1721faf Compare June 12, 2022 18:51
@connorlay connorlay marked this pull request as ready for review June 12, 2022 18:51
@the-mikedavis
Copy link
Member

Should there be a distinct highlight for special_attribute_name? @keyword might be a good fit

@connorlay
Copy link
Member Author

Should there be a distinct highlight for special_attribute_name? @Keyword might be a good fit

Ah good call, I think there should be!

@connorlay
Copy link
Member Author

connorlay commented Jun 12, 2022

@the-mikedavis Once this is merged I'll open a PR against Helix and Neovim to update the highlights 🙂

grammar.js Outdated Show resolved Hide resolved
@connorlay connorlay requested a review from the-mikedavis June 13, 2022 15:28
grammar.js Outdated Show resolved Hide resolved
@connorlay connorlay requested a review from the-mikedavis June 13, 2022 15:50
Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 🚀

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 this pull request may close these issues.

3 participants