aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/javascript
diff options
context:
space:
mode:
authorGammut2023-07-09 16:35:32 +0000
committerGitHub2023-07-09 16:35:32 +0000
commit607b426e269b17f4ad32dca9c612c4a9f8541766 (patch)
treef9e57fa45041c066bf2ea4ecca692986f66291c1 /runtime/queries/javascript
parent28452e1f2a63fe4806078da0f854d01506fc0c0c (diff)
Refactor queries for ecma based languages (#7207)
Diffstat (limited to 'runtime/queries/javascript')
-rw-r--r--runtime/queries/javascript/highlights.scm39
-rw-r--r--runtime/queries/javascript/indents.scm4
-rw-r--r--runtime/queries/javascript/injections.scm4
-rw-r--r--runtime/queries/javascript/locals.scm4
-rw-r--r--runtime/queries/javascript/tags.scm89
-rw-r--r--runtime/queries/javascript/textobjects.scm4
6 files changed, 16 insertions, 128 deletions
diff --git a/runtime/queries/javascript/highlights.scm b/runtime/queries/javascript/highlights.scm
index 58843479..2a40b372 100644
--- a/runtime/queries/javascript/highlights.scm
+++ b/runtime/queries/javascript/highlights.scm
@@ -1,38 +1,3 @@
-; Function and method parameters
-;-------------------------------
+; See runtime/queries/ecma/README.md for more info.
-; (p) => ...
-(formal_parameters
- (identifier) @variable.parameter)
-
-; (...p) => ...
-(formal_parameters
- (rest_pattern
- (identifier) @variable.parameter))
-
-; ({ p }) => ...
-(formal_parameters
- (object_pattern
- (shorthand_property_identifier_pattern) @variable.parameter))
-
-; ({ a: p }) => ...
-(formal_parameters
- (object_pattern
- (pair_pattern
- value: (identifier) @variable.parameter)))
-
-; ([ p ]) => ...
-(formal_parameters
- (array_pattern
- (identifier) @variable.parameter))
-
-; (p = 1) => ...
-(formal_parameters
- (assignment_pattern
- left: (identifier) @variable.parameter))
-
-; p => ...
-(arrow_function
- parameter: (identifier) @variable.parameter)
-
-; inherits: ecma
+; inherits: _javascript,ecma
diff --git a/runtime/queries/javascript/indents.scm b/runtime/queries/javascript/indents.scm
index 04328f09..2a40b372 100644
--- a/runtime/queries/javascript/indents.scm
+++ b/runtime/queries/javascript/indents.scm
@@ -1 +1,3 @@
-; inherits: ecma
+; See runtime/queries/ecma/README.md for more info.
+
+; inherits: _javascript,ecma
diff --git a/runtime/queries/javascript/injections.scm b/runtime/queries/javascript/injections.scm
index 04328f09..2a40b372 100644
--- a/runtime/queries/javascript/injections.scm
+++ b/runtime/queries/javascript/injections.scm
@@ -1 +1,3 @@
-; inherits: ecma
+; See runtime/queries/ecma/README.md for more info.
+
+; inherits: _javascript,ecma
diff --git a/runtime/queries/javascript/locals.scm b/runtime/queries/javascript/locals.scm
index 04328f09..2a40b372 100644
--- a/runtime/queries/javascript/locals.scm
+++ b/runtime/queries/javascript/locals.scm
@@ -1 +1,3 @@
-; inherits: ecma
+; See runtime/queries/ecma/README.md for more info.
+
+; inherits: _javascript,ecma
diff --git a/runtime/queries/javascript/tags.scm b/runtime/queries/javascript/tags.scm
index a7bbd311..2a40b372 100644
--- a/runtime/queries/javascript/tags.scm
+++ b/runtime/queries/javascript/tags.scm
@@ -1,88 +1,3 @@
-(
- (comment)* @doc
- .
- (method_definition
- name: (property_identifier) @name) @definition.method
- (#not-eq? @name "constructor")
- (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
- (#select-adjacent! @doc @definition.method)
-)
+; See runtime/queries/ecma/README.md for more info.
-(
- (comment)* @doc
- .
- [
- (class
- name: (_) @name)
- (class_declaration
- name: (_) @name)
- ] @definition.class
- (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
- (#select-adjacent! @doc @definition.class)
-)
-
-(
- (comment)* @doc
- .
- [
- (function
- name: (identifier) @name)
- (function_declaration
- name: (identifier) @name)
- (generator_function
- name: (identifier) @name)
- (generator_function_declaration
- name: (identifier) @name)
- ] @definition.function
- (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
- (#select-adjacent! @doc @definition.function)
-)
-
-(
- (comment)* @doc
- .
- (lexical_declaration
- (variable_declarator
- name: (identifier) @name
- value: [(arrow_function) (function)]) @definition.function)
- (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
- (#select-adjacent! @doc @definition.function)
-)
-
-(
- (comment)* @doc
- .
- (variable_declaration
- (variable_declarator
- name: (identifier) @name
- value: [(arrow_function) (function)]) @definition.function)
- (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
- (#select-adjacent! @doc @definition.function)
-)
-
-(assignment_expression
- left: [
- (identifier) @name
- (member_expression
- property: (property_identifier) @name)
- ]
- right: [(arrow_function) (function)]
-) @definition.function
-
-(pair
- key: (property_identifier) @name
- value: [(arrow_function) (function)]) @definition.function
-
-(
- (call_expression
- function: (identifier) @name) @reference.call
- (#not-match? @name "^(require)$")
-)
-
-(call_expression
- function: (member_expression
- property: (property_identifier) @name)
- arguments: (_) @reference.call)
-
-(new_expression
- constructor: (_) @name) @reference.class
+; inherits: _javascript,ecma
diff --git a/runtime/queries/javascript/textobjects.scm b/runtime/queries/javascript/textobjects.scm
index 04328f09..2a40b372 100644
--- a/runtime/queries/javascript/textobjects.scm
+++ b/runtime/queries/javascript/textobjects.scm
@@ -1 +1,3 @@
-; inherits: ecma
+; See runtime/queries/ecma/README.md for more info.
+
+; inherits: _javascript,ecma