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

Add HEEx language injection for ~H sigils #34

Merged
merged 2 commits into from
Apr 18, 2022

Conversation

connorlay
Copy link
Contributor

@connorlay connorlay commented Apr 17, 2022

See #2 and phoenixframework/tree-sitter-heex#11

This PR adds tree-sitter-heex language injection into ~H sigils provided by Phoenix Live View.

Here is an example of syntax highlighting of https://github.com/fly-apps/live_beats/blob/master/lib/live_beats_web/live/layout_component.ex:
image

@the-mikedavis
Copy link
Member

This looks quite nice in Helix as well :)

livebeats-helix

This is a bit off-topic for this PR, but what do you think about using @keyword for the captures of the templating tokens:

; https://github.com/the-mikedavis/helix/blob/b2e8c9188e83c95adf5e5cb9d63b487686d7f610/runtime/queries/heex/highlights.scm#L20-L28

; Non-comment or tag delimiters
[
  "{"
  "}"
  "<%"
  "<%="
  "<%%="
  "%>"
] @keyword

@keyword is a bit "loud" depending on how the capture is themed but it's in line with the ERB/EJS highlights: https://github.com/tree-sitter/tree-sitter-embedded-template/blob/d21df11b0ecc6fd211dbe11278e92ef67bd17e97/queries/highlights.scm

Copy link
Member

@jonatanklosko jonatanklosko left a comment

Choose a reason for hiding this comment

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

Thanks!

@jonatanklosko jonatanklosko merged commit ec1c4ca into elixir-lang:main Apr 18, 2022
@connorlay connorlay deleted the heex-injections branch April 18, 2022 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants