chore(ecma,jsx): update parser and queries

This commit is contained in:
Amaan Qureshi 2024-01-31 10:55:10 -05:00
parent 364b86ec8e
commit 6da205148f
6 changed files with 27 additions and 9 deletions

View file

@ -297,7 +297,7 @@
"revision": "2b57cd9541f9fd3a89207d054ce8fbe72657c444"
},
"javascript": {
"revision": "f1e5a09b8d02f8209a68249c93f0ad647b228e6e"
"revision": "6d84193ae2395e54b699d9b7358bcf66cbcc19f5"
},
"jq": {
"revision": "13990f530e8e6709b7978503da9bc8701d366791"

View file

@ -3,7 +3,7 @@
(for_statement)
(while_statement)
(arrow_function)
(function)
(function_expression)
(function_declaration)
(class_declaration)
(method_definition)

View file

@ -36,7 +36,7 @@
; Function and method definitions
;--------------------------------
(function
(function_expression
name: (identifier) @function)
(function_declaration
@ -61,7 +61,7 @@
(pair
key: (property_identifier) @function.method
value: (function))
value: (function_expression))
(pair
key: (property_identifier) @function.method
@ -77,7 +77,7 @@
left:
(member_expression
property: (property_identifier) @function.method)
right: (function))
right: (function_expression))
(variable_declarator
name: (identifier) @function
@ -85,7 +85,7 @@
(variable_declarator
name: (identifier) @function
value: (function))
value: (function_expression))
(assignment_expression
left: (identifier) @function
@ -93,7 +93,7 @@
(assignment_expression
left: (identifier) @function
right: (function))
right: (function_expression))
; Function and method calls
;--------------------------
@ -158,7 +158,10 @@
(undefined)
] @constant.builtin
(comment) @comment @spell
[
(comment)
(html_comment)
] @comment @spell
((comment) @comment.documentation
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))

View file

@ -16,6 +16,7 @@
]
(#lua-match? @injection.language "^[a-zA-Z][a-zA-Z0-9]*$")
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#not-eq? @injection.language "svg"))
; svg`...` or svg(`...`), which uses the html parser, so is not included in the previous query
@ -30,6 +31,7 @@
(template_string) @injection.content
]
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "html"))
(call_expression
@ -39,6 +41,7 @@
arguments:
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "graphql")))
(call_expression
@ -48,6 +51,7 @@
arguments:
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "glimmer")))
((glimmer_template) @injection.content
@ -62,6 +66,7 @@
arguments:
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
; styled(Component)`<css>`
@ -73,6 +78,7 @@
arguments:
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
; styled.div.attrs({ prop: "foo" })`<css>`
@ -88,6 +94,7 @@
arguments:
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
; styled(Component).attrs({ prop: "foo" })`<css>`
@ -103,6 +110,7 @@
arguments:
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
((regex_pattern) @injection.content
@ -115,6 +123,7 @@
((template_string) @injection.content
(#lua-match? @injection.content "^`#graphql")
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "graphql"))
; el.innerHTML = `<html>`
@ -125,6 +134,7 @@
(#any-of? @_prop "outerHTML" "innerHTML"))
right: (template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "html"))
; el.innerHTML = '<html>'
@ -157,6 +167,7 @@
value:
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "angular")))))))
; @Component({
@ -178,6 +189,7 @@
(array
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "css"))))))))
; @Component({
@ -197,5 +209,6 @@
(#eq? @_prop "styles"))
value:
((template_string) @injection.content
(#set! injection.include-children)
(#offset! @injection.content 0 1 0 -1)
(#set! injection.language "css")))))))

View file

@ -2,7 +2,7 @@
;-------
(statement_block) @local.scope
(function) @local.scope
(function_expression) @local.scope
(arrow_function) @local.scope

View file

@ -62,4 +62,6 @@
(identifier) @tag.builtin
(property_identifier) @tag))
(html_character_reference) @tag
(jsx_text) @none