summaryrefslogtreecommitdiff
path: root/runtime/queries
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/queries')
-rw-r--r--runtime/queries/javascript/highlights-params.scm12
-rw-r--r--runtime/queries/javascript/highlights.scm37
-rw-r--r--runtime/queries/javascript/locals.scm8
3 files changed, 44 insertions, 13 deletions
diff --git a/runtime/queries/javascript/highlights-params.scm b/runtime/queries/javascript/highlights-params.scm
deleted file mode 100644
index 95ffc724..00000000
--- a/runtime/queries/javascript/highlights-params.scm
+++ /dev/null
@@ -1,12 +0,0 @@
-(formal_parameters
- [
- (identifier) @variable.parameter
- (array_pattern
- (identifier) @variable.parameter)
- (object_pattern
- [
- (pair_pattern value: (identifier) @variable.parameter)
- (shorthand_property_identifier_pattern) @variable.parameter
- ])
- ]
-)
diff --git a/runtime/queries/javascript/highlights.scm b/runtime/queries/javascript/highlights.scm
index 60336c3b..9e30d0e7 100644
--- a/runtime/queries/javascript/highlights.scm
+++ b/runtime/queries/javascript/highlights.scm
@@ -46,6 +46,43 @@
(assignment_expression
left: (identifier) @function
right: [(function) (arrow_function)])
+
+; Function and method parameters
+;-------------------------------
+
+; (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)
; Function and method calls
;--------------------------
diff --git a/runtime/queries/javascript/locals.scm b/runtime/queries/javascript/locals.scm
index 5d680acf..cc5f2e14 100644
--- a/runtime/queries/javascript/locals.scm
+++ b/runtime/queries/javascript/locals.scm
@@ -12,7 +12,13 @@
; Definitions
;------------
-(pattern/identifier)@local.definition
+(pattern/identifier) @local.definition
+
+(pattern/rest_pattern
+ (identifier) @local.definition)
+
+(arrow_function
+ parameter: (identifier) @local.definition)
(variable_declarator
name: (identifier) @local.definition)