]> git.eshelyaron.com Git - emacs.git/commitdiff
js-ts-mode: Highlight function parameters inside destructuring
authorDmitry Gutov <dmitry@gutov.dev>
Fri, 8 Dec 2023 02:20:39 +0000 (04:20 +0200)
committerDmitry Gutov <dmitry@gutov.dev>
Fri, 8 Dec 2023 02:20:39 +0000 (04:20 +0200)
* lisp/progmodes/js.el (js--treesit-font-lock-settings):
Highlight function parameters declared using destructuring syntax.

lisp/progmodes/js.el

index eb4adc627ee82d167ff907dedb7eb1551fd70418..07d12cb7b4b2bb84533a797e6cd0827f96f2e2a1 100644 (file)
@@ -3545,7 +3545,10 @@ Check if a node type is available, then return the right indent rules."
      (method_definition
       name: (property_identifier) @font-lock-function-name-face)
 
-     (formal_parameters (identifier) @font-lock-variable-name-face)
+     (formal_parameters
+      [(identifier) @font-lock-variable-name-face
+       (array_pattern (identifier) @font-lock-variable-name-face)
+       (object_pattern (shorthand_property_identifier_pattern) @font-lock-variable-name-face)])
 
      (variable_declarator
       name: (identifier) @font-lock-variable-name-face)