Add Heex language

This commit is contained in:
Max Brunsfeld 2023-06-12 16:29:59 -07:00
parent 01bd5c30fc
commit df76ab98cf
8 changed files with 195 additions and 104 deletions

View file

@ -0,0 +1,7 @@
; Phoenix HTML template
((sigil
(sigil_name) @_sigil_name
(quoted_content) @content)
(#eq? @_sigil_name "H")
(#set! language "heex"))

View file

@ -9,4 +9,4 @@
"%>"
"-%>"
"_%>"
] @keyword
] @keyword

View file

@ -0,0 +1,7 @@
name = "HEEX"
path_suffixes = ["heex"]
autoclose_before = ">})"
brackets = [
{ start = "<", end = ">", close = true, newline = true },
]
block_comment = ["<%#", "%>"]

View file

@ -0,0 +1,54 @@
; HEEx delimiters
[
"%>"
"--%>"
"-->"
"/>"
"<!"
"<!--"
"<"
"<%!--"
"<%"
"<%#"
"<%%="
"<%="
"</"
"</:"
"<:"
">"
"{"
"}"
] @punctuation.bracket
; HEEx operators are highlighted as such
"=" @operator
; HEEx inherits the DOCTYPE tag from HTML
(doctype) @constant
(comment) @comment
; HEEx tags and slots are highlighted as HTML
[
(tag_name)
(slot_name)
] @tag
; HEEx attributes are highlighted as HTML attributes
(attribute_name) @attribute
; HEEx special attributes are highlighted as keywords
(special_attribute_name) @keyword
[
(attribute_value)
(quoted_attribute_value)
] @string
; HEEx components are highlighted as Elixir modules and functions
(component_name
[
(module) @module
(function) @function
"." @punctuation.delimiter
])

View file

@ -0,0 +1,13 @@
((directive (partial_expression_value) @content)
(#set! language "elixir")
(#set! include-children)
(#set! combined))
; Regular expression_values do not need to be combined
((directive (expression_value) @content)
(#set! language "elixir"))
; expressions live within HTML tags, and do not need to be combined
; <link href={ Routes.static_path(..) } />
((expression (expression_value) @content)
(#set! language "elixir"))