mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-12 00:10:04 -04:00
style: alternation in template literal query
This commit is contained in:
parent
1ba94e9f01
commit
f15db0b652
1 changed files with 20 additions and 19 deletions
|
|
@ -3,26 +3,27 @@
|
||||||
|
|
||||||
(comment) @comment
|
(comment) @comment
|
||||||
|
|
||||||
; html(`...`), sql(...) etc
|
; html(`...`), html`...`, sql(...) etc
|
||||||
(call_expression
|
|
||||||
function: ((identifier) @language)
|
|
||||||
arguments: (arguments
|
|
||||||
(template_string) @content
|
|
||||||
(#offset! @content 0 1 0 -1))
|
|
||||||
)
|
|
||||||
|
|
||||||
; html`...`, sql`...` etc
|
|
||||||
(call_expression
|
|
||||||
function: ((identifier) @language)
|
|
||||||
arguments: ((template_string) @content
|
|
||||||
(#offset! @content 0 1 0 -1))
|
|
||||||
)
|
|
||||||
|
|
||||||
; svg`...`, which uses the html parser
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: ((identifier) @_name (#eq? @_name "svg"))
|
function: ((identifier) @language)
|
||||||
arguments: ((template_string) @html
|
arguments: [
|
||||||
(#offset! @html 0 1 0 -1)))
|
(arguments
|
||||||
|
(template_string) @content)
|
||||||
|
(template_string) @content
|
||||||
|
]
|
||||||
|
(#offset! @content 0 1 0 -1)
|
||||||
|
(#not-eq? @content "svg"))
|
||||||
|
|
||||||
|
; svg`...` or svg(`...`), which uses the html parser, so is not included in the previous query
|
||||||
|
(call_expression
|
||||||
|
function: ((identifier) @svg)
|
||||||
|
arguments: [
|
||||||
|
(arguments
|
||||||
|
(template_string) @content)
|
||||||
|
(template_string) @content
|
||||||
|
]
|
||||||
|
(#offset! @content 0 1 0 -1)
|
||||||
|
(#eq? @content "svg"))
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: ((identifier) @_name
|
function: ((identifier) @_name
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue