]> git.eshelyaron.com Git - emacs.git/commitdiff
ruby-ts-mode: Highlight method and block parameters
authorDmitry Gutov <dgutov@yandex.ru>
Fri, 6 Jan 2023 02:48:35 +0000 (04:48 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Fri, 6 Jan 2023 02:48:35 +0000 (04:48 +0200)
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--font-lock-settings):
Add rules for method and block parameters.
(ruby-ts-mode): Add corresponding feature.

lisp/progmodes/ruby-ts-mode.el

index 9416b650eb1668afd1e19bd3b18f982f93df930e..349318e75790bfc4e0c093a357e278f6c098721d 100644 (file)
@@ -290,6 +290,21 @@ values of OVERRIDE"
      (method
       name: (setter) @font-lock-function-name-face))
 
+   :language language
+   :feature 'parameter-definition
+   '((method_parameters
+      (identifier) @font-lock-variable-name-face)
+     (block_parameters
+      (identifier) @font-lock-variable-name-face)
+     (optional_parameter
+      name: (identifier) @font-lock-variable-name-face)
+     (splat_parameter
+      name: (identifier) @font-lock-variable-name-face)
+     (hash_splat_parameter
+      name: (identifier) @font-lock-variable-name-face)
+     (block_parameter
+      name: (identifier) @font-lock-variable-name-face))
+
    ;; Yuan recommends also putting method definitions into the
    ;; 'function' category (thus keeping it in both).  I've opted to
    ;; just use separate categories for them -- dgutov.
@@ -936,7 +951,7 @@ leading double colon is not added."
   (setq-local treesit-font-lock-settings (ruby-ts--font-lock-settings 'ruby))
   ;; Level 3 is the default.
   (setq-local treesit-font-lock-feature-list
-              '(( comment method-definition )
+              '(( comment method-definition parameter-definition)
                 ( keyword regexp string type)
                 ( builtin-variable builtin-constant constant
                   delimiter escape-sequence