-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: javascript and typescript queries (#34)
* Update class.scm * Update class.scm * refactor: simplify query * add: more tests * fix: missing parser --------- Co-authored-by: Luckas <[email protected]>
- Loading branch information
1 parent
f96222d
commit 8c5766c
Showing
7 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
; inherits: tsx | ||
|
||
(call_expression | ||
function: [ | ||
(identifier) @ident | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
; inherits: javascript | ||
(call_expression | ||
function: [ | ||
(identifier) @ident | ||
(member_expression | ||
object: (identifier) @object-ident) | ||
] | ||
(#any-of? @ident "clsx" "classnames" "tw" "css") | ||
(#eq? @object-ident "tw") | ||
arguments: [ | ||
(arguments | ||
(_)+) @tailwind ; the actual class range is extracted in the code | ||
(template_string | ||
(string_fragment) @tailwind) | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ local parsers = { | |
"heex", | ||
"elixir", | ||
"javascript", | ||
"typescript", | ||
"templ", | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const color = "text-blue-300"; | ||
|
||
const Component = () => { | ||
return ( | ||
<div> | ||
<div | ||
className="flex items-center justify-center container mx-auto p-4 | ||
border-2 border-gray-500 rounded-md bg-gray-100" | ||
> | ||
<div className="text-2xl font-bold mb-4"> | ||
Lorem ipsum dolor sit amet, qui minim labore adipisicing minim sint | ||
cillum sint consectetur cupidatat. | ||
</div> | ||
<div className={`${color} bg-gray-100`}> | ||
Lorem ipsum dolor sit amet, qui minim labore adipisicing minim sint | ||
cillum sint consectetur cupidatat. | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Component; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
clsx("p-4", "text-center"); | ||
classnames("bg-red-500", "uppercase"); | ||
tw`font-mono text-sm` | ||
tw.input`border hover:border-black` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require("tests.queries.runner").test({ | ||
name = "typescript", | ||
provider = "treesitter", | ||
file = "tests/queries/typescript/test.ts", | ||
ranges = { | ||
{ 0, 5, 0, 25 }, | ||
{ 1, 11, 1, 36 }, | ||
{ 2, 3, 2, 20 }, | ||
{ 3, 9, 3, 34 }, | ||
}, | ||
}) |