diff options
Diffstat (limited to 'queries/heex')
| -rw-r--r-- | queries/heex/folds.scm | 5 | ||||
| -rw-r--r-- | queries/heex/highlights.scm | 15 | ||||
| -rw-r--r-- | queries/heex/indents.scm | 17 | ||||
| -rw-r--r-- | queries/heex/injections.scm | 1 | ||||
| -rw-r--r-- | queries/heex/locals.scm | 10 |
5 files changed, 33 insertions, 15 deletions
diff --git a/queries/heex/folds.scm b/queries/heex/folds.scm index 414890e9..88d4f17f 100644 --- a/queries/heex/folds.scm +++ b/queries/heex/folds.scm @@ -1,5 +1,6 @@ -; HEEx folds similar to HTML +; HEEx tags, components, and slots fold similar to HTML [ - (tag) (component) + (tag) + (slot) ] @fold diff --git a/queries/heex/highlights.scm b/queries/heex/highlights.scm index 611e637f..7dd4dd6f 100644 --- a/queries/heex/highlights.scm +++ b/queries/heex/highlights.scm @@ -1,4 +1,4 @@ -; HEEx tag and component delimiters +; HEEx delimiters [ "%>" "--%>" @@ -13,20 +13,19 @@ "<%%=" "<%=" "</" + "</:" + "<:" ">" "{" "}" ] @tag.delimiter -; HEEx operators +; HEEx operators are highlighted as such "=" @operator ; HEEx inherits the DOCTYPE tag from HTML (doctype) @constant -; HEEx tags are highlighted as HTML tags -(tag_name) @tag - ; HEEx comments are highlighted as such (comment) @comment @@ -36,6 +35,12 @@ ; Tree-sitter parser errors (ERROR) @error +; HEEx tags and slots are highlighted as HTML +[ + (tag_name) + (slot_name) +] @tag + ; HEEx attributes are highlighted as HTML attributes (attribute_name) @tag.attribute [ diff --git a/queries/heex/indents.scm b/queries/heex/indents.scm index e2a08713..99fc693d 100644 --- a/queries/heex/indents.scm +++ b/queries/heex/indents.scm @@ -1,11 +1,20 @@ -; HEEx indents like HTML +; HEEx tags, components, and slots indent like HTML [ (component) + (slot) (tag) ] @indent -; Dedent at the end of each tag +; Dedent at the end of each tag, component, and slot [ - (end_tag) (end_component) -] @branch + (end_slot) + (end_tag) +] @branch @dedent + +; Self-closing tags and components should not change +; indentation level of sibling nodes +[ + (self_closing_component) + (self_closing_tag) +] @auto diff --git a/queries/heex/injections.scm b/queries/heex/injections.scm index af99e688..fffd1dc5 100644 --- a/queries/heex/injections.scm +++ b/queries/heex/injections.scm @@ -7,4 +7,5 @@ ; HEEx Elixir expressions are always within a tag or component (expression (expression_value) @elixir) +; HEEx comments (comment) @comment diff --git a/queries/heex/locals.scm b/queries/heex/locals.scm index 3f99132e..4371bc97 100644 --- a/queries/heex/locals.scm +++ b/queries/heex/locals.scm @@ -1,11 +1,13 @@ -; HEEx tags and components are references +; HEEx tags, components, and slots are references [ - (tag_name) (component_name) + (slot_name) + (tag_name) ] @reference -; Create a new scope within each HEEx tag or component +; Create a new scope within each HEEx tag, component, and slot [ - (tag) (component) + (slot) + (tag) ] @scope |
