diff options
author | ChrHorn | 2022-08-01 20:15:17 +0000 |
---|---|---|
committer | GitHub | 2022-08-01 20:15:17 +0000 |
commit | 59bf1669ece4e614cc4a351f400124021191bb51 (patch) | |
tree | 89544a6e28266ef10bdcf3718b51536c70d63c8d /runtime | |
parent | 07019c390545bad1b3710a99cf2398eb6c7b151a (diff) |
javascript queries: fix parameters (#3280)
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/queries/javascript/highlights-params.scm | 12 | ||||
-rw-r--r-- | runtime/queries/javascript/highlights.scm | 37 | ||||
-rw-r--r-- | runtime/queries/javascript/locals.scm | 8 |
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) |