From a1573a9135c608e68cb383f752623527be84bdce Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Mon, 2 Sep 2024 03:56:02 -0400 Subject: [PATCH] feat(javascript): update parser and queries --- lockfile.json | 2 +- queries/ecma/injections.scm | 75 ++++++++++++------------------------- 2 files changed, 24 insertions(+), 53 deletions(-) diff --git a/lockfile.json b/lockfile.json index a74f11fe4..724aa3629 100644 --- a/lockfile.json +++ b/lockfile.json @@ -354,7 +354,7 @@ "revision": "245b05c6ba900fa708242835f6168ef76f9d951e" }, "javascript": { - "revision": "15887341e5b57ffdb423aff840aef142b8f53d6d" + "revision": "463fec0831011cab830429fbe1da2796cfc1cfb4" }, "jq": { "revision": "13990f530e8e6709b7978503da9bc8701d366791" diff --git a/queries/ecma/injections.scm b/queries/ecma/injections.scm index ef5e14297..04abafcde 100644 --- a/queries/ecma/injections.scm +++ b/queries/ecma/injections.scm @@ -7,11 +7,7 @@ ; html(`...`), html`...`, sql(`...`), etc. (call_expression - function: [ - (await_expression - (identifier) @injection.language) - (identifier) @injection.language - ] + function: (identifier) @injection.language arguments: [ (arguments (template_string) @injection.content) @@ -27,13 +23,8 @@ ; svg`...` or svg(`...`) (call_expression - function: [ - (await_expression - (identifier) @_name - (#eq? @_name "svg")) - ((identifier) @_name - (#eq? @_name "svg")) - ] + function: (identifier) @_name + (#eq? @_name "svg") arguments: [ (arguments (template_string) @injection.content) @@ -46,13 +37,8 @@ ; Vercel PostgreSQL ; foo.sql`...` or foo.sql(`...`) (call_expression - function: [ - (await_expression - (member_expression - property: (property_identifier) @injection.language)) - (member_expression - property: (property_identifier) @injection.language) - ] + function: (member_expression + property: (property_identifier) @injection.language) arguments: [ (arguments (template_string) @injection.content) @@ -63,44 +49,29 @@ (#set! injection.include-children)) (call_expression - function: [ - (await_expression - (identifier) @_name - (#eq? @_name "gql")) - ((identifier) @_name - (#eq? @_name "gql")) - ] - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.include-children) - (#set! injection.language "graphql"))) + function: (identifier) @_name + (#eq? @_name "gql") + arguments: (template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.include-children) + (#set! injection.language "graphql")) (call_expression - function: [ - (await_expression - (identifier) @_name - (#eq? @_name "hbs")) - ((identifier) @_name - (#eq? @_name "hbs")) - ] - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.include-children) - (#set! injection.language "glimmer"))) + function: (identifier) @_name + (#eq? @_name "hbs") + arguments: (template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.include-children) + (#set! injection.language "glimmer")) ; css``, keyframes`` (call_expression - function: [ - (await_expression - (identifier) @_name - (#any-of? @_name "css" "keyframes")) - ((identifier) @_name - (#any-of? @_name "css" "keyframes")) - ] - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.include-children) - (#set! injection.language "styled"))) + function: (identifier) @_name + (#any-of? @_name "css" "keyframes") + arguments: (template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.include-children) + (#set! injection.language "styled")) ; styled.div`` (call_expression