]> 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)
committerEshel Yaron <me@eshelyaron.com>
Sat, 9 Dec 2023 19:12:38 +0000 (20:12 +0100)
* lisp/progmodes/js.el (js--treesit-font-lock-settings):
Highlight function parameters declared using destructuring syntax.

lisp/progmodes/js.el

index 5570cca42c675ec039f896ebaf047721b8aea6a0..b3a0f5a7c04722fcd040c62451dc87c41d805333 100644 (file)
@@ -3536,7 +3536,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)