diff options
| author | Clay <connorlay@pm.me> | 2022-01-30 16:15:24 -0800 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2022-01-31 09:19:01 +0100 |
| commit | 083aee08735fd5dcd02ef72d831b054244db73a4 (patch) | |
| tree | 9e7073d77a5e2ba256ebaef6e8ae401ffee2c1bf | |
| parent | ci: add folds to CI output to better group related information (diff) | |
| download | nvim-treesitter-083aee08735fd5dcd02ef72d831b054244db73a4.tar nvim-treesitter-083aee08735fd5dcd02ef72d831b054244db73a4.tar.gz nvim-treesitter-083aee08735fd5dcd02ef72d831b054244db73a4.tar.bz2 nvim-treesitter-083aee08735fd5dcd02ef72d831b054244db73a4.tar.lz nvim-treesitter-083aee08735fd5dcd02ef72d831b054244db73a4.tar.xz nvim-treesitter-083aee08735fd5dcd02ef72d831b054244db73a4.tar.zst nvim-treesitter-083aee08735fd5dcd02ef72d831b054244db73a4.zip | |
Support HEEx slots
| -rw-r--r-- | lockfile.json | 2 | ||||
| -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 |
6 files changed, 34 insertions, 16 deletions
diff --git a/lockfile.json b/lockfile.json index b6c8044a7..5cee2cd44 100644 --- a/lockfile.json +++ b/lockfile.json @@ -111,7 +111,7 @@ "revision": "3cb7fc28247efbcb2973b97e71c78838ad98a583" }, "heex": { - "revision": "d8b5b9f016cd3c7b0ee916cf031d9a2188c0fc44" + "revision": "592e22292a367312c35e13de7fdb888f029981d6" }, "hjson": { "revision": "02fa3b79b3ff9a296066da6277adfc3f26cbc9e0" diff --git a/queries/heex/folds.scm b/queries/heex/folds.scm index 414890e91..88d4f17ff 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 611e637fb..7dd4dd6fd 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 e2a08713b..99fc693dc 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 af99e688e..fffd1dc53 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 3f99132e1..4371bc979 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 |
