Skip to content

Commit

Permalink
feat: heex support (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
luckasRanarison committed Jul 24, 2024
1 parent ce3ab3f commit 5616be6
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/tailwind-tools/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ local supported_filetypes = {
"vue",
"svelte",
"astro",
"heex",
"elixir",
"htmldjango",
"javascriptreact",
"typescriptreact",
Expand Down
7 changes: 7 additions & 0 deletions queries/heex/class.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
; inherits: html

(attribute
(attribute_name) @_attribute_name
(#eq? @_attribute_name "class")
(expression
(expression_value) @tailwind))
9 changes: 9 additions & 0 deletions tests/queries/heex/index.html.heex
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="p-4 bg-gray-100">
<h1 class={@header}>Lorem ipsum</h1>
<p class={class([
"flex items-center justify-between",
{"text-green-600", @condition}
])}>
Lorem ipsum dolor sit amet, qui minim labore adipisicing minim sint cillum sint consectetur cupidatat.
</p>
</div>
11 changes: 11 additions & 0 deletions tests/queries/heex_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
local common = require("tests.queries.common")
local runner = common.Runner:new("tests/queries/heex/index.html.heex")

describe("queries heex:", function()
runner:classes(3)
runner:ranges({
{ 0, 12, 0, 27 },
{ 1, 13, 1, 20 },
{ 2, 12, 5, 4 },
})
end)

0 comments on commit 5616be6

Please sign in to comment.