aboutsummaryrefslogtreecommitdiffstats
path: root/queries/ecma
diff options
context:
space:
mode:
authorAmaan Qureshi <amaanq12@gmail.com>2024-01-31 10:55:10 -0500
committerAmaan Qureshi <amaanq12@gmail.com>2024-01-31 22:31:50 -0500
commit6da205148fb43eb4fa70888fd6ac46a32f1fc3f2 (patch)
tree3c52a2e14c858752541b9e71427c8fce413d4a8a /queries/ecma
parentci: use M1 for macOS (diff)
downloadnvim-treesitter-6da205148fb43eb4fa70888fd6ac46a32f1fc3f2.tar
nvim-treesitter-6da205148fb43eb4fa70888fd6ac46a32f1fc3f2.tar.gz
nvim-treesitter-6da205148fb43eb4fa70888fd6ac46a32f1fc3f2.tar.bz2
nvim-treesitter-6da205148fb43eb4fa70888fd6ac46a32f1fc3f2.tar.lz
nvim-treesitter-6da205148fb43eb4fa70888fd6ac46a32f1fc3f2.tar.xz
nvim-treesitter-6da205148fb43eb4fa70888fd6ac46a32f1fc3f2.tar.zst
nvim-treesitter-6da205148fb43eb4fa70888fd6ac46a32f1fc3f2.zip
chore(ecma,jsx): update parser and queries
Diffstat (limited to 'queries/ecma')
-rw-r--r--queries/ecma/folds.scm2
-rw-r--r--queries/ecma/highlights.scm15
-rw-r--r--queries/ecma/injections.scm13
-rw-r--r--queries/ecma/locals.scm2
4 files changed, 24 insertions, 8 deletions
diff --git a/queries/ecma/folds.scm b/queries/ecma/folds.scm
index 50f235a5d..5cc48064b 100644
--- a/queries/ecma/folds.scm
+++ b/queries/ecma/folds.scm
@@ -3,7 +3,7 @@
(for_statement)
(while_statement)
(arrow_function)
- (function)
+ (function_expression)
(function_declaration)
(class_declaration)
(method_definition)
diff --git a/queries/ecma/highlights.scm b/queries/ecma/highlights.scm
index 4156222cb..f5f2d5614 100644
--- a/queries/ecma/highlights.scm
+++ b/queries/ecma/highlights.scm
@@ -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 "^/[*][*][^*].*[*]/$"))
diff --git a/queries/ecma/injections.scm b/queries/ecma/injections.scm
index d23e2fdfa..00ff12c5a 100644
--- a/queries/ecma/injections.scm
+++ b/queries/ecma/injections.scm
@@ -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")))))))
diff --git a/queries/ecma/locals.scm b/queries/ecma/locals.scm
index 24297940c..24ea7c0a8 100644
--- a/queries/ecma/locals.scm
+++ b/queries/ecma/locals.scm
@@ -2,7 +2,7 @@
;-------
(statement_block) @local.scope
-(function) @local.scope
+(function_expression) @local.scope
(arrow_function) @local.scope