feat!: drop modules, general refactor and cleanup

This commit is contained in:
Christian Clason 2023-06-12 09:54:30 -06:00
parent 310f0925ec
commit 692b051b09
1247 changed files with 6096 additions and 9074 deletions

View file

@ -0,0 +1,6 @@
; HEEx tags, components, and slots fold similar to HTML
[
(component)
(tag)
(slot)
] @fold

View file

@ -0,0 +1,54 @@
; HEEx delimiters
[
"%>"
"--%>"
"-->"
"/>"
"<!"
"<!--"
"<"
"<%!--"
"<%"
"<%#"
"<%%="
"<%="
"</"
"</:"
"<:"
">"
"{"
"}"
] @tag.delimiter
; HEEx operators are highlighted as such
"=" @operator
; HEEx inherits the DOCTYPE tag from HTML
(doctype) @constant
; HEEx comments are highlighted as such
(comment) @comment @spell
; HEEx text content is treated as markup
; (text) @none
; HEEx tags and slots are highlighted as HTML
[
(tag_name)
(slot_name)
] @tag
; HEEx attributes are highlighted as HTML attributes
(attribute_name) @tag.attribute
[
(attribute_value)
(quoted_attribute_value)
] @string
; HEEx components are highlighted as modules and function calls
(component_name
[
(module) @type
(function) @function
"." @punctuation.delimiter
])

View file

@ -0,0 +1,20 @@
; HEEx tags, components, and slots indent like HTML
[
(component)
(slot)
(tag)
] @indent.begin
; Dedent at the end of each tag, component, and slot
[
(end_component)
(end_slot)
(end_tag)
] @indent.branch @indent.dedent
; Self-closing tags and components should not change
; indentation level of sibling nodes
[
(self_closing_component)
(self_closing_tag)
] @indent.auto

View file

@ -0,0 +1,30 @@
; directives are standalone tags like '<%= @x %>'
;
; partial_expression_values are elixir code that is part of an expression that
; spans multiple directive nodes, so they must be combined. For example:
; <%= if true do %>
; <p>hello, tree-sitter!</p>
; <% end %>
(directive
[
(partial_expression_value)
(ending_expression_value)
] @injection.content
(#set! injection.language "elixir")
(#set! injection.include-children)
(#set! injection.combined))
; Regular expression_values do not need to be combined
((directive
(expression_value) @injection.content)
(#set! injection.language "elixir"))
; expressions live within HTML tags, and do not need to be combined
; <link href={ Routes.static_path(..) } />
(expression
(expression_value) @injection.content
(#set! injection.language "elixir"))
; HEEx comments
((comment) @injection.content
(#set! injection.language "comment"))

View file

@ -0,0 +1,13 @@
; HEEx tags, components, and slots are references
[
(component_name)
(slot_name)
(tag_name)
] @local.reference
; Create a new scope within each HEEx tag, component, and slot
[
(component)
(slot)
(tag)
] @local.scope