feat(javascript): update parser and queries

This commit is contained in:
Amaan Qureshi 2024-09-02 03:56:02 -04:00 committed by Christian Clason
parent e090c5b22d
commit a1573a9135
2 changed files with 24 additions and 53 deletions

View file

@ -354,7 +354,7 @@
"revision": "245b05c6ba900fa708242835f6168ef76f9d951e" "revision": "245b05c6ba900fa708242835f6168ef76f9d951e"
}, },
"javascript": { "javascript": {
"revision": "15887341e5b57ffdb423aff840aef142b8f53d6d" "revision": "463fec0831011cab830429fbe1da2796cfc1cfb4"
}, },
"jq": { "jq": {
"revision": "13990f530e8e6709b7978503da9bc8701d366791" "revision": "13990f530e8e6709b7978503da9bc8701d366791"

View file

@ -7,11 +7,7 @@
; html(`...`), html`...`, sql(`...`), etc. ; html(`...`), html`...`, sql(`...`), etc.
(call_expression (call_expression
function: [ function: (identifier) @injection.language
(await_expression
(identifier) @injection.language)
(identifier) @injection.language
]
arguments: [ arguments: [
(arguments (arguments
(template_string) @injection.content) (template_string) @injection.content)
@ -27,13 +23,8 @@
; svg`...` or svg(`...`) ; svg`...` or svg(`...`)
(call_expression (call_expression
function: [ function: (identifier) @_name
(await_expression (#eq? @_name "svg")
(identifier) @_name
(#eq? @_name "svg"))
((identifier) @_name
(#eq? @_name "svg"))
]
arguments: [ arguments: [
(arguments (arguments
(template_string) @injection.content) (template_string) @injection.content)
@ -46,13 +37,8 @@
; Vercel PostgreSQL ; Vercel PostgreSQL
; foo.sql`...` or foo.sql(`...`) ; foo.sql`...` or foo.sql(`...`)
(call_expression (call_expression
function: [ function: (member_expression
(await_expression property: (property_identifier) @injection.language)
(member_expression
property: (property_identifier) @injection.language))
(member_expression
property: (property_identifier) @injection.language)
]
arguments: [ arguments: [
(arguments (arguments
(template_string) @injection.content) (template_string) @injection.content)
@ -63,44 +49,29 @@
(#set! injection.include-children)) (#set! injection.include-children))
(call_expression (call_expression
function: [ function: (identifier) @_name
(await_expression (#eq? @_name "gql")
(identifier) @_name arguments: (template_string) @injection.content
(#eq? @_name "gql")) (#offset! @injection.content 0 1 0 -1)
((identifier) @_name (#set! injection.include-children)
(#eq? @_name "gql")) (#set! injection.language "graphql"))
]
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "graphql")))
(call_expression (call_expression
function: [ function: (identifier) @_name
(await_expression (#eq? @_name "hbs")
(identifier) @_name arguments: (template_string) @injection.content
(#eq? @_name "hbs")) (#offset! @injection.content 0 1 0 -1)
((identifier) @_name (#set! injection.include-children)
(#eq? @_name "hbs")) (#set! injection.language "glimmer"))
]
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "glimmer")))
; css`<css>`, keyframes`<css>` ; css`<css>`, keyframes`<css>`
(call_expression (call_expression
function: [ function: (identifier) @_name
(await_expression (#any-of? @_name "css" "keyframes")
(identifier) @_name arguments: (template_string) @injection.content
(#any-of? @_name "css" "keyframes")) (#offset! @injection.content 0 1 0 -1)
((identifier) @_name (#set! injection.include-children)
(#any-of? @_name "css" "keyframes")) (#set! injection.language "styled"))
]
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
; styled.div`<css>` ; styled.div`<css>`
(call_expression (call_expression