summaryrefslogtreecommitdiff
path: root/queries/heex
diff options
context:
space:
mode:
authorClay <connorlay@pm.me>2021-08-15 09:40:02 -0700
committerThomas Vigouroux <tomvig38@gmail.com>2021-08-18 14:07:59 +0200
commit57c2081e3fde09ad1d87e04ecc7b85caa42df1bf (patch)
treec6fb6e091621bd04778a6ee8af976e6f24b1b37d /queries/heex
parentb8a6928b529fff6ea04593b381e73d4cbc9a9cdc (diff)
Add HEEx language support, add missing commentstrings
Diffstat (limited to 'queries/heex')
-rw-r--r--queries/heex/folds.scm5
-rw-r--r--queries/heex/highlights.scm35
-rw-r--r--queries/heex/indents.scm11
-rw-r--r--queries/heex/injections.scm7
4 files changed, 58 insertions, 0 deletions
diff --git a/queries/heex/folds.scm b/queries/heex/folds.scm
new file mode 100644
index 00000000..414890e9
--- /dev/null
+++ b/queries/heex/folds.scm
@@ -0,0 +1,5 @@
+; HEEx folds similar to HTML
+[
+ (tag)
+ (component)
+] @fold
diff --git a/queries/heex/highlights.scm b/queries/heex/highlights.scm
new file mode 100644
index 00000000..d9d0b0c6
--- /dev/null
+++ b/queries/heex/highlights.scm
@@ -0,0 +1,35 @@
+; HEEx text is highlighted as such
+(text) @text
+
+; HEEx has two types of comments, both are highlighted as such
+(comment) @comment
+
+; HEEx attributes are highlighted as HTML attributes
+(attribute_name) @tag.attribute
+
+; Attributes are highlighted as strings
+(quoted_attribute_value) @string
+
+; HEEx supports HTML tags and are highlighted as such
+[
+ "<"
+ ">"
+ "</"
+ "/>"
+ "<%"
+ "<%="
+ "<%%="
+ "<%#"
+ "%>"
+ "{"
+ "}"
+] @tag.delimiter
+
+; HEEx tags are highlighted as HTML
+(tag_name) @tag
+
+; HEEx components are highlighted as types (Elixir modules)
+(component_name) @type
+
+; HEEx operators
+["="] @operator
diff --git a/queries/heex/indents.scm b/queries/heex/indents.scm
new file mode 100644
index 00000000..02771b01
--- /dev/null
+++ b/queries/heex/indents.scm
@@ -0,0 +1,11 @@
+; HEEx indents like HTML
+[
+ (component)
+ (tag)
+] @indent
+
+; Dedent at the end of each tag
+[
+ (end_tag)
+ (end_component)
+] @branch
diff --git a/queries/heex/injections.scm b/queries/heex/injections.scm
new file mode 100644
index 00000000..de3b4202
--- /dev/null
+++ b/queries/heex/injections.scm
@@ -0,0 +1,7 @@
+; Directives are combined to support do blocks
+(directive (expression_value) @elixir @combined)
+
+; Expressions are not combined, as they exist separately from do blocks
+(expression (expression_value) @elixir)
+
+(comment) @comment