mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 03:40:04 -04:00
feat(ecma): inject async template functions
This commit is contained in:
parent
bbc67f736e
commit
9d5cee38b3
1 changed files with 34 additions and 10 deletions
|
|
@ -5,9 +5,13 @@
|
||||||
((comment) @injection.content
|
((comment) @injection.content
|
||||||
(#set! injection.language "comment"))
|
(#set! injection.language "comment"))
|
||||||
|
|
||||||
; html(`...`), html`...`, sql(...) etc
|
; html(`...`), html`...`, sql(`...`), etc.
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (identifier) @injection.language
|
function: [
|
||||||
|
(await_expression
|
||||||
|
(identifier)) @injection.language
|
||||||
|
(identifier) @injection.language
|
||||||
|
]
|
||||||
arguments: [
|
arguments: [
|
||||||
(arguments
|
(arguments
|
||||||
(template_string) @injection.content)
|
(template_string) @injection.content)
|
||||||
|
|
@ -23,8 +27,13 @@
|
||||||
|
|
||||||
; svg`...` or svg(`...`)
|
; svg`...` or svg(`...`)
|
||||||
(call_expression
|
(call_expression
|
||||||
function: ((identifier) @_name
|
function: [
|
||||||
(#eq? @_name "svg"))
|
(await_expression
|
||||||
|
(identifier) @_name
|
||||||
|
(#eq? @_name "svg"))
|
||||||
|
(identifier) @_name
|
||||||
|
(#eq? @_name "svg")
|
||||||
|
]
|
||||||
arguments: [
|
arguments: [
|
||||||
(arguments
|
(arguments
|
||||||
(template_string) @injection.content)
|
(template_string) @injection.content)
|
||||||
|
|
@ -35,16 +44,26 @@
|
||||||
(#set! injection.language "html"))
|
(#set! injection.language "html"))
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: ((identifier) @_name
|
function: [
|
||||||
(#eq? @_name "gql"))
|
(await_expression
|
||||||
|
(identifier) @_name
|
||||||
|
(#eq? @_name "gql"))
|
||||||
|
(identifier) @_name
|
||||||
|
(#eq? @_name "gql")
|
||||||
|
]
|
||||||
arguments: ((template_string) @injection.content
|
arguments: ((template_string) @injection.content
|
||||||
(#offset! @injection.content 0 1 0 -1)
|
(#offset! @injection.content 0 1 0 -1)
|
||||||
(#set! injection.include-children)
|
(#set! injection.include-children)
|
||||||
(#set! injection.language "graphql")))
|
(#set! injection.language "graphql")))
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: ((identifier) @_name
|
function: [
|
||||||
(#eq? @_name "hbs"))
|
(await_expression
|
||||||
|
(identifier) @_name
|
||||||
|
(#eq? @_name "hbs"))
|
||||||
|
(identifier) @_name
|
||||||
|
(#eq? @_name "hbs")
|
||||||
|
]
|
||||||
arguments: ((template_string) @injection.content
|
arguments: ((template_string) @injection.content
|
||||||
(#offset! @injection.content 0 1 0 -1)
|
(#offset! @injection.content 0 1 0 -1)
|
||||||
(#set! injection.include-children)
|
(#set! injection.include-children)
|
||||||
|
|
@ -55,8 +74,13 @@
|
||||||
|
|
||||||
; css`<css>`, keyframes`<css>`
|
; css`<css>`, keyframes`<css>`
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (identifier) @_name
|
function: [
|
||||||
(#any-of? @_name "css" "keyframes")
|
(await_expression
|
||||||
|
(identifier) @_name
|
||||||
|
(#any-of? @_name "css" "keyframes"))
|
||||||
|
(identifier) @_name
|
||||||
|
(#any-of? @_name "css" "keyframes")
|
||||||
|
]
|
||||||
arguments: ((template_string) @injection.content
|
arguments: ((template_string) @injection.content
|
||||||
(#offset! @injection.content 0 1 0 -1)
|
(#offset! @injection.content 0 1 0 -1)
|
||||||
(#set! injection.include-children)
|
(#set! injection.include-children)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue